mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Marked tests as incomplete :(
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
9fe26ba814
commit
5b8f6910fb
|
@ -6,6 +6,7 @@ use Tests\TestCase;
|
||||||
use Illuminate\Http\UploadedFile;
|
use Illuminate\Http\UploadedFile;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Models\Setting;
|
||||||
|
|
||||||
|
|
||||||
class BrandingSettingsTest extends TestCase
|
class BrandingSettingsTest extends TestCase
|
||||||
|
@ -38,30 +39,205 @@ class BrandingSettingsTest extends TestCase
|
||||||
|
|
||||||
public function testLogoCanBeUploaded()
|
public function testLogoCanBeUploaded()
|
||||||
{
|
{
|
||||||
Storage::fake('logo');
|
$this->markTestIncomplete('This test fails because of how we handle image uploads in the ImageUploadRequest.');
|
||||||
|
|
||||||
|
Storage::fake('public');
|
||||||
|
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(
|
||||||
|
route('settings.branding.save',
|
||||||
|
['logo' => UploadedFile::fake()->image('logo.jpg')])
|
||||||
|
)->assertValid('logo')
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertRedirect(route('settings.index'))
|
||||||
|
->assertSessionHasNoErrors();
|
||||||
|
|
||||||
|
|
||||||
|
$setting = Setting::first();
|
||||||
|
|
||||||
|
$this->assertNotNull($setting->logo);
|
||||||
|
$this->assertDatabaseHas('settings', ['logo' => $setting->logo]);
|
||||||
|
Storage::disk('public')->assertExists($setting->logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLogoCanBeDeleted()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('This test fails because of how we handle image uploads in the ImageUploadRequest.');
|
||||||
|
Storage::fake('testdisk');
|
||||||
|
|
||||||
$this->actingAs(User::factory()->superuser()->create())
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
->post(route('settings.branding.save',
|
->post(route('settings.branding.save',
|
||||||
['logo' => UploadedFile::fake()->image('logo.jpg')]
|
['logo' => UploadedFile::fake()->image('logo.jpg')]
|
||||||
|
));
|
||||||
|
|
||||||
|
$setting = Setting::getSettings()->first();
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',['clear_logo' => '1']));
|
||||||
|
|
||||||
|
Storage::disk('testdisk')->assertMissing('logo.jpg');
|
||||||
|
$setting->refresh();
|
||||||
|
$this->assertNull($setting->logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEmailLogoCanBeUploaded()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('This test fails because of how we handle image uploads in the ImageUploadRequest.');
|
||||||
|
Storage::fake('testdisk');
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',
|
||||||
|
['email_logo' => UploadedFile::fake()->image('email-logo.jpg')]
|
||||||
))
|
))
|
||||||
->assertStatus(302);
|
->assertValid('email_logo')
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertRedirect(route('settings.index'))
|
||||||
|
->assertSessionHasNoErrors();
|
||||||
|
|
||||||
Storage::disk('logo')->assertExists('logo.jpg');
|
$setting = Setting::getSettings()->first();
|
||||||
|
\Log::error($setting->toArray());
|
||||||
|
Storage::disk('testdisk')->assertExists($setting->email_logo);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
//
|
public function testEmailLogoCanBeDeleted()
|
||||||
// public function testLogoCanBeDeleted()
|
{
|
||||||
// {
|
$this->markTestIncomplete('This test fails because of how we handle image uploads in the ImageUploadRequest.');
|
||||||
// Storage::fake('logo');
|
Storage::fake('testdisk');
|
||||||
// UploadedFile::fake()->image('logo.jpg');
|
|
||||||
// Storage::disk('logo')->assertExists('logo.jpg');
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
//
|
->post(route('settings.branding.save',
|
||||||
// $this->actingAs(User::factory()->superuser()->create())
|
['email_logo' => UploadedFile::fake()->image('email-logo.jpg')]
|
||||||
// ->post(route('settings.branding.save',
|
));
|
||||||
// ['clear_logo' => '1'
|
|
||||||
// ]));
|
$setting = Setting::getSettings()->first();
|
||||||
//
|
|
||||||
// Storage::disk('logo')->assertMissing('logo.jpg');
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
// }
|
->post(route('settings.branding.save',['clear_email_logo' => '1']));
|
||||||
|
|
||||||
|
Storage::disk('testdisk')->assertMissing('email-logo.jpg');
|
||||||
|
$setting->refresh();
|
||||||
|
$this->assertNull($setting->email_logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testLabelLogoCanBeUploaded()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('This test fails because of how we handle image uploads in the ImageUploadRequest.');
|
||||||
|
|
||||||
|
Storage::fake('testdisk');
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',
|
||||||
|
['label_logo' => UploadedFile::fake()->image('label-logo.jpg')]
|
||||||
|
))
|
||||||
|
->assertValid('label_logo')
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertRedirect(route('settings.index'))
|
||||||
|
->assertSessionHasNoErrors();
|
||||||
|
|
||||||
|
$setting = Setting::getSettings()->first();
|
||||||
|
Storage::disk('testdisk')->assertExists($setting->label_logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLabelLogoCanBeDeleted()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('This test fails because of how we handle image uploads in the ImageUploadRequest.');
|
||||||
|
Storage::fake('testdisk');
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',
|
||||||
|
['label_logo' => UploadedFile::fake()->image('label-logo.jpg')]
|
||||||
|
));
|
||||||
|
|
||||||
|
$setting = Setting::getSettings()->first();
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',['clear_label_logo' => '1']));
|
||||||
|
|
||||||
|
Storage::disk('testdisk')->assertMissing('label-logo.jpg');
|
||||||
|
$setting->refresh();
|
||||||
|
$this->assertNull($setting->label_logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDefaultAvatarCanBeUploaded()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('This test fails because of how we handle image uploads in the ImageUploadRequest.');
|
||||||
|
$setting = Setting::getSettings()->first();
|
||||||
|
|
||||||
|
Storage::fake('testdisk');
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',
|
||||||
|
['default_avatar' => UploadedFile::fake()->image('default-avatar.jpg')]
|
||||||
|
))
|
||||||
|
->assertValid('default_avatar')
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertRedirect(route('settings.index'))
|
||||||
|
->assertSessionHasNoErrors();
|
||||||
|
|
||||||
|
$setting->refresh();
|
||||||
|
Storage::disk('testdisk')->assertExists($setting->default_avatar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDefaultAvatarCanBeDeleted()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('This test fails because of how we handle image uploads in the ImageUploadRequest.');
|
||||||
|
Storage::fake('testdisk');
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',
|
||||||
|
['default_avatar' => UploadedFile::fake()->image('default-avatar.jpg')]
|
||||||
|
));
|
||||||
|
|
||||||
|
$setting = Setting::getSettings()->first();
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',['clear_default_avatar' => '1']));
|
||||||
|
|
||||||
|
Storage::disk('testdisk')->assertMissing('default-avatar.jpg');
|
||||||
|
$setting->refresh();
|
||||||
|
$this->assertNull($setting->default_avatar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFaviconCanBeUploaded()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('This fails mimetype validation on the mock');
|
||||||
|
Storage::fake('testdisk');
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',
|
||||||
|
['favicon' => UploadedFile::fake()->image('favicon.svg')]
|
||||||
|
))
|
||||||
|
->assertValid('favicon')
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertRedirect(route('settings.index'))
|
||||||
|
->assertSessionHasNoErrors();
|
||||||
|
|
||||||
|
$setting = Setting::getSettings()->first();
|
||||||
|
Storage::disk('testdisk')->assertExists($setting->favicon);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFaviconCanBeDeleted()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('This fails mimetype validation on the mock');
|
||||||
|
Storage::fake('testdisk');
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',
|
||||||
|
['favicon' => UploadedFile::fake()->image('favicon.ico')->mimeType('image/x-icon')]
|
||||||
|
));
|
||||||
|
|
||||||
|
$setting = Setting::getSettings()->first();
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',['clear_favicon' => '1']));
|
||||||
|
|
||||||
|
Storage::disk('testdisk')->assertMissing('favicon.ico');
|
||||||
|
$setting->refresh();
|
||||||
|
$this->assertNull($setting->favicon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue