34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Permission;
|
|
|
|
use App\User;
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
use Tests\TestCase;
|
|
|
|
class UserIndexTest extends TestCase
|
|
{
|
|
|
|
use DatabaseTransactions;
|
|
|
|
public function testItOpensSettingsPage(): void
|
|
{
|
|
$this->login()->loginNami();
|
|
auth()->user()->update(['firstname' => 'Jane', 'lastname' => 'Doe']);
|
|
User::factory()->create(['firstname' => 'John', 'lastname' => 'Doe']);
|
|
$anna = User::factory()->create(['firstname' => 'Anna', 'lastname' => 'Doe']);
|
|
$this->get(route('setting.view', ['settingGroup' => 'user']))
|
|
->assertOk()
|
|
->assertComponent('setting/User')
|
|
->assertInertiaPath('data.data.0.firstname', 'Anna')
|
|
->assertInertiaPath('data.data.0.lastname', 'Doe')
|
|
->assertInertiaPath('data.data.0.id', $anna->id)
|
|
->assertInertiaPath('data.data.0.links.update', route('user.update', ['user' => $anna]))
|
|
->assertInertiaPath('data.data.1.firstname', 'Jane')
|
|
->assertInertiaPath('data.data.2.firstname', 'John')
|
|
->assertInertiaPath('data.meta.default.firstname', '')
|
|
->assertInertiaPath('data.meta.default.email', '')
|
|
->assertInertiaPath('data.meta.links.store', route('user.store'));
|
|
}
|
|
}
|