Lean control center at mini.ladill.com: payment QR CRUD, Paystack checkout with 5% fee settlement via Billing API, payments feed, and payouts. QR codes use a fixed black-and-white preset only. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\QrCode;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Str;
|
|
use Tests\TestCase;
|
|
|
|
class SearchTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
private function user(): User
|
|
{
|
|
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
|
|
}
|
|
|
|
public function test_user_can_search_owned_event_by_label(): void
|
|
{
|
|
$user = $this->user();
|
|
|
|
QrCode::query()->create([
|
|
'user_id' => $user->id,
|
|
'short_code' => 'summit',
|
|
'type' => QrCode::TYPE_EVENT,
|
|
'label' => 'NextGen Summit',
|
|
'destination_url' => 'https://example.com',
|
|
'is_active' => true,
|
|
]);
|
|
|
|
$response = $this->actingAs($user)
|
|
->getJson(route('events.search', ['q' => 'NextGen']));
|
|
|
|
$response->assertOk();
|
|
$response->assertJsonPath('results.0.type', 'event');
|
|
$response->assertJsonPath('results.0.title', 'NextGen Summit');
|
|
}
|
|
|
|
public function test_search_page_renders_for_authenticated_user(): void
|
|
{
|
|
$user = $this->user();
|
|
|
|
$this->actingAs($user)
|
|
->get(route('events.search'))
|
|
->assertOk()
|
|
->assertSee('Find events and programmes', false);
|
|
}
|
|
}
|