feat: menric
This commit is contained in:
@@ -53,6 +53,11 @@ class PhotoReadTest extends TestCase
|
||||
$this->actingAs($a, 'admin')
|
||||
->get(route('admin.devices.photo', [$device, $photo->id]))
|
||||
->assertOk();
|
||||
$this->assertSame(0, PhotoRead::query()->count());
|
||||
|
||||
$this->actingAs($a, 'admin')
|
||||
->get(route('admin.devices.photo', [$device, $photo->id, 'seen' => 1]))
|
||||
->assertOk();
|
||||
|
||||
$this->assertSame(1, PhotoRead::query()->count());
|
||||
$row = PhotoRead::query()->first();
|
||||
@@ -71,7 +76,7 @@ class PhotoReadTest extends TestCase
|
||||
->assertJsonPath('data.0.read', 0);
|
||||
|
||||
$this->actingAs($a, 'admin')
|
||||
->get(route('admin.devices.photo', [$device, $photo->id]))
|
||||
->get(route('admin.devices.photo', [$device, $photo->id, 'seen' => 1]))
|
||||
->assertOk();
|
||||
$this->assertSame(1, PhotoRead::query()->count());
|
||||
}
|
||||
@@ -108,11 +113,13 @@ class PhotoReadTest extends TestCase
|
||||
$this->storePng($device, 'b.png');
|
||||
PhotoRead::mark($seen, 'admin', (int) $admin->id);
|
||||
|
||||
$this->actingAs($admin, 'admin')
|
||||
$tab = $this->actingAs($admin, 'admin')
|
||||
->getJson(route('admin.devices.tabData', [$device, 'tab' => 'photos', 'read' => '0']))
|
||||
->assertOk()
|
||||
->assertJsonPath('count', 1)
|
||||
->assertJsonPath('data.0.read', 0);
|
||||
|
||||
$this->assertStringContainsString('seen=1', (string) $tab->json('data.0.url'));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
@@ -136,16 +143,17 @@ class PhotoReadTest extends TestCase
|
||||
$photo = $this->storePng($device);
|
||||
|
||||
$this->actingAs($admin, 'admin')
|
||||
->get(route('admin.devices.photo', [$device, $photo->id]))
|
||||
->get(route('admin.devices.photo', [$device, $photo->id, 'seen' => 1]))
|
||||
->assertOk();
|
||||
|
||||
$this->actingAs($agent, 'agent')
|
||||
$list = $this->actingAs($agent, 'agent')
|
||||
->getJson(route('user.photos.data'))
|
||||
->assertOk()
|
||||
->assertJsonPath('data.0.read', 0);
|
||||
$this->assertStringNotContainsString('seen=1', (string) $list->json('data.0.url'));
|
||||
|
||||
$this->actingAs($agent, 'agent')
|
||||
->get(route('user.devices.photo', [$device, $photo->id]))
|
||||
->get(route('user.devices.photo', [$device, $photo->id, 'seen' => 1]))
|
||||
->assertOk();
|
||||
|
||||
$this->assertSame(2, PhotoRead::query()->count());
|
||||
|
||||
Reference in New Issue
Block a user