Fix listener test

This commit is contained in:
Bubka 2022-07-18 16:35:25 +02:00
parent 879cfac701
commit 64da81b5a7
2 changed files with 32 additions and 8 deletions

View File

@ -7,6 +7,7 @@
use Tests\TestCase;
use App\Listeners\CleanIconStorage;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Event;
/**
@ -30,4 +31,15 @@ public function test_it_deletes_icon_file_on_twofaccount_deletion()
$this->assertNull($listener->handle($event));
}
public function test_CleanIconStorage_listen_to_TwoFAccountDeleted_event()
{
Event::fake();
Event::assertListening(
TwoFAccountDeleted::class,
CleanIconStorage::class
);
}
}

View File

@ -4,21 +4,33 @@
use App\Models\Group;
use App\Events\GroupDeleting;
use Tests\FeatureTestCase;
use Tests\TestCase;
use App\Listeners\DissociateTwofaccountFromGroup;
use Illuminate\Support\Facades\Event;
/**
* @covers \App\Listeners\DissociateTwofaccountFromGroup
*/
class DissociateTwofaccountFromGroupTest extends FeatureTestCase
class DissociateTwofaccountFromGroupTest extends TestCase
{
public function test_twofaccount_is_released_on_group_deletion()
{
$group = Group::factory()->make();
$event = new GroupDeleting($group);
$listener = new DissociateTwofaccountFromGroup();
// public function test_twofaccount_is_released_on_group_deletion()
// {
// $group = Group::factory()->make();
// $event = new GroupDeleting($group);
// $listener = new DissociateTwofaccountFromGroup();
$this->assertNull($listener->handle($event));
// $this->assertNull($listener->handle($event));
// }
public function test_DissociateTwofaccountFromGroup_listen_to_groupDeleting_event()
{
Event::fake();
Event::assertListening(
GroupDeleting::class,
DissociateTwofaccountFromGroup::class
);
}
}