adrema/tests/Feature/Activity/IndexTest.php

29 lines
1.0 KiB
PHP
Raw Normal View History

2023-02-14 14:27:11 +01:00
<?php
namespace Tests\Feature\Activity;
use App\Activity;
2023-02-23 22:43:13 +01:00
use App\Subactivity;
2023-02-14 14:27:11 +01:00
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
class IndexTest extends TestCase
{
use DatabaseTransactions;
2023-03-04 23:47:42 +01:00
public function testItDisplaysActivities(): void
2023-02-14 14:27:11 +01:00
{
2023-02-14 14:32:34 +01:00
$this->login()->loginNami()->withoutExceptionHandling();
2023-02-25 17:19:17 +01:00
$first = Activity::factory()->name('Local')->create();
2023-02-23 22:43:13 +01:00
Activity::factory()->name('Remote')->inNami(123)->create();
2023-02-14 14:27:11 +01:00
$response = $this->get('/activity');
$this->assertInertiaHas('Local', $response, 'data.data.0.name');
2023-02-25 17:19:17 +01:00
$this->assertInertiaHas(route('activity.update', ['activity' => $first]), $response, 'data.data.0.links.update');
$this->assertInertiaHas(route('activity.destroy', ['activity' => $first]), $response, 'data.data.0.links.destroy');
2023-12-30 01:19:02 +01:00
$this->assertInertiaHas(route('membership.masslist.index'), $response, 'data.meta.links.membership_masslist');
2023-03-04 23:47:42 +01:00
$this->assertCount(2, $this->inertia($response, 'data.data'));
2023-02-14 14:27:11 +01:00
}
}