mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Added tests
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
44bcc157e5
commit
947fb7af7a
|
@ -2,15 +2,66 @@
|
||||||
|
|
||||||
namespace Tests\Feature\Settings;
|
namespace Tests\Feature\Settings;
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
use Illuminate\Http\UploadedFile;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
|
||||||
class BrandingSettingsTest extends TestCase
|
class BrandingSettingsTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testSiteNameIsRequired()
|
public function testSiteNameIsRequired()
|
||||||
{
|
{
|
||||||
$this->actingAs(User::factory()->superuser()->create())
|
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->from(route('settings.branding.index'))
|
||||||
->post(route('settings.branding.save', ['site_name' => '']))
|
->post(route('settings.branding.save', ['site_name' => '']))
|
||||||
->assertInvalid('site_name');
|
->assertSessionHasErrors(['site_name'])
|
||||||
|
->assertInvalid(['site_name'])
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertRedirect(route('settings.branding.index'));
|
||||||
|
|
||||||
|
$this->followRedirects($response)->assertSee(trans('general.error'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSiteNameCanBeSaved()
|
||||||
|
{
|
||||||
|
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save', ['site_name' => 'MyAwesomeSite']))
|
||||||
|
->assertStatus(302)
|
||||||
|
->assertValid('site_name')
|
||||||
|
->assertRedirect(route('settings.index'))
|
||||||
|
->assertSessionHasNoErrors();
|
||||||
|
|
||||||
|
$this->followRedirects($response)->assertSee('Success');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testLogoCanBeUploaded()
|
||||||
|
{
|
||||||
|
Storage::fake('logo');
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->superuser()->create())
|
||||||
|
->post(route('settings.branding.save',
|
||||||
|
['logo' => UploadedFile::fake()->image('logo.jpg')]
|
||||||
|
))
|
||||||
|
->assertStatus(302);
|
||||||
|
|
||||||
|
Storage::disk('logo')->assertExists('logo.jpg');
|
||||||
|
}
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public function testLogoCanBeDeleted()
|
||||||
|
// {
|
||||||
|
// Storage::fake('logo');
|
||||||
|
// UploadedFile::fake()->image('logo.jpg');
|
||||||
|
// Storage::disk('logo')->assertExists('logo.jpg');
|
||||||
|
//
|
||||||
|
// $this->actingAs(User::factory()->superuser()->create())
|
||||||
|
// ->post(route('settings.branding.save',
|
||||||
|
// ['clear_logo' => '1'
|
||||||
|
// ]));
|
||||||
|
//
|
||||||
|
// Storage::disk('logo')->assertMissing('logo.jpg');
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue