adrema/tests/Feature/Membership/TestersBlockTest.php

36 lines
1.2 KiB
PHP
Raw Normal View History

2022-11-17 02:15:29 +01:00
<?php
namespace Tests\Feature\Membership;
use App\Member\Member;
use App\Member\Membership;
use Illuminate\Foundation\Testing\DatabaseTransactions;
2024-10-13 21:00:47 +02:00
use Livewire\Livewire;
use Modules\Member\TestersBlock;
2022-11-17 02:15:29 +01:00
use Tests\TestCase;
class TestersBlockTest extends TestCase
{
use DatabaseTransactions;
public function testItHasData(): void
{
$this->login()->loginNami();
Member::factory()
->defaults()
2023-09-05 16:29:22 +02:00
->has(Membership::factory()->in('Schnuppermitgliedschaft', 7, 'Wölfling', 8)->state(['from' => now()->subMonths(10)]))
2022-11-17 02:15:29 +01:00
->create(['firstname' => 'Max', 'lastname' => 'Muster']);
2024-10-13 21:00:47 +02:00
Member::factory()
->defaults()
2023-09-05 16:29:22 +02:00
->has(Membership::factory()->ended()->in('Schnuppermitgliedschaft', 7, 'Wölfling', 8)->state(['from' => now()->subMonths(10)]))
2024-10-13 21:00:47 +02:00
->create(['firstname' => 'Jane', 'lastname' => 'Muster']);
2022-11-17 02:15:29 +01:00
2024-10-13 21:00:47 +02:00
Livewire::test(TestersBlock::class)
->assertSee('Max Muster')
->assertSee(now()->subMonths(10)->addWeeks(8)->format('d.m.Y'))
->assertSee(now()->subMonths(10)->addWeeks(8)->diffForHumans())
->assertDontSee('Jane');
2022-11-17 02:15:29 +01:00
}
}