adrema/tests/EndToEnd/MemberSearchTest.php

31 lines
859 B
PHP
Raw Normal View History

2024-01-28 11:42:32 +01:00
<?php
namespace Tests\EndToEnd;
2024-08-30 22:04:14 +02:00
use App\Country;
2024-01-28 11:42:32 +01:00
use App\Member\Member;
use Tests\EndToEndTestCase;
class MemberSearchTest extends EndToEndTestCase
{
2024-08-30 22:04:14 +02:00
public function setUp(): void
{
parent::setUp();
Country::factory()->create(['name' => 'Deutschland']);
2024-08-29 22:59:55 +02:00
$this->withoutExceptionHandling()->login()->loginNami();
2024-08-30 22:04:14 +02:00
}
2024-01-28 11:42:32 +01:00
public function testItHandlesFullTextSearch(): void
{
Member::factory()->defaults()->count(2)->create(['firstname' => 'Alexander']);
Member::factory()->defaults()->create(['firstname' => 'Heinrich']);
sleep(1);
$this->post(route('member.search'), ['filter' => ['search' => 'Alexander']])
->assertJsonCount(2, 'data');
$this->post(route('member.search'), ['filter' => ['search' => 'Heinrich']])
->assertJsonCount(1, 'data');
}
}