5 changed files with 108 additions and 71 deletions
-
11app/Http/Controllers/Users/AgencyController.php
-
7app/Http/Controllers/Users/ProfileController.php
-
BINpublic/assets/imgs/default-logo.png
-
85tests/Feature/AgencyProfileTest.php
-
76tests/Feature/Users/UserProfileTest.php
|
Before Width: 400 | Height: 400 | Size: 58 KiB After Width: 200 | Height: 200 | Size: 22 KiB |
@ -0,0 +1,85 @@ |
|||
<?php |
|||
|
|||
namespace Tests\Feature\Users; |
|||
|
|||
use Tests\TestCase; |
|||
|
|||
/** |
|||
* Agency Profile Controller |
|||
* |
|||
* @author Nafies Luthfi <nafiesL@gmail.com> |
|||
*/ |
|||
class AgencyProfileTest extends TestCase |
|||
{ |
|||
/** @test */ |
|||
public function admin_user_can_visit_agency_page() |
|||
{ |
|||
$user = $this->adminUserSigningIn(); |
|||
$this->visit(route('users.agency.show')); |
|||
$this->seePageIs(route('users.agency.show')); |
|||
} |
|||
|
|||
/** @test */ |
|||
public function admin_user_can_update_agency_data() |
|||
{ |
|||
$user = $this->adminUserSigningIn(); |
|||
$this->visit(route('users.agency.edit')); |
|||
|
|||
$this->submitForm(trans('agency.update'), [ |
|||
'name' => 'Nama Agensi Saya', |
|||
'tagline' => 'Tagline agensi saya', |
|||
'email' => 'nama_agensi@domain.com', |
|||
'address' => 'Jln. Kalimantan, No. 20, Kota', |
|||
'phone' => '081234567890', |
|||
'website' => 'https://example.com', |
|||
]); |
|||
|
|||
$this->see(trans('agency.updated')); |
|||
$this->seePageIs(route('users.agency.show')); |
|||
|
|||
$this->seeInDatabase('site_options', [ |
|||
'key' => 'agency_name', |
|||
'value' => 'Nama Agensi Saya', |
|||
]); |
|||
$this->seeInDatabase('site_options', [ |
|||
'key' => 'agency_email', |
|||
'value' => 'nama_agensi@domain.com', |
|||
]); |
|||
$this->seeInDatabase('site_options', [ |
|||
'key' => 'agency_address', |
|||
'value' => 'Jln. Kalimantan, No. 20, Kota', |
|||
]); |
|||
$this->seeInDatabase('site_options', [ |
|||
'key' => 'agency_phone', |
|||
'value' => '081234567890', |
|||
]); |
|||
$this->seeInDatabase('site_options', [ |
|||
'key' => 'agency_website', |
|||
'value' => 'https://example.com', |
|||
]); |
|||
$this->seeInDatabase('site_options', [ |
|||
'key' => 'agency_tagline', |
|||
'value' => 'Tagline agensi saya', |
|||
]); |
|||
} |
|||
|
|||
/** @test */ |
|||
public function admin_user_can_update_agency_logo_image() |
|||
{ |
|||
$user = $this->adminUserSigningIn(); |
|||
$this->visit(route('users.agency.edit')); |
|||
|
|||
$this->attach(storage_path('app/sample-image.jpg'), 'logo'); |
|||
$this->press(trans('agency.logo_upload')); |
|||
|
|||
$this->see(trans('agency.updated')); |
|||
$this->seePageIs(route('users.agency.show')); |
|||
|
|||
$this->seeInDatabase('site_options', [ |
|||
'key' => 'agency_logo_path', |
|||
'value' => 'sample-image.jpg', |
|||
]); |
|||
|
|||
$this->assertFileExistsThenDelete(public_path('assets/imgs/sample-image.jpg')); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue