Skip to content

Commit

Permalink
fix test now it's working with delete job
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Jul 11, 2024
1 parent dc72ba0 commit 6d8b4b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Feature/Http/Controllers/EntityControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace Tests\Feature\Http\Controllers;

use App\Jobs\FolderDeleteEntity;
use App\Models\Entity;
use App\Models\Federation;
use App\Models\Membership;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Queue;
use Tests\TestCase;

class EntityControllerTest extends TestCase
Expand Down Expand Up @@ -1410,6 +1412,9 @@ public function an_admin_can_change_an_existing_entities_federation_membership()
/** @test */
public function an_admin_can_purge_an_existing_entity()
{

Queue::fake();

$admin = User::factory()->create(['admin' => true]);
$entity = Entity::factory()->create([
'deleted_at' => now(),
Expand All @@ -1421,11 +1426,14 @@ public function an_admin_can_purge_an_existing_entity()
->actingAs($admin)
->delete(route('entities.destroy', $entity))
->assertSeeText(__('entities.destroyed', ['name' => $name]));

Queue::assertPushed(FolderDeleteEntity::class);
}

/** @test */
public function an_admin_can_reject_a_new_entity_request()
{
Queue::fake();
$admin = User::factory()->create(['admin' => true]);
$federation = Federation::factory()->create();
$entity = Entity::factory()->create(['approved' => false]);
Expand All @@ -1440,6 +1448,8 @@ public function an_admin_can_reject_a_new_entity_request()
->actingAs($admin)
->delete(route('memberships.destroy', $membership))
->assertSeeText(__('federations.membership_rejected', ['entity' => $entity->name_en]));

Queue::assertPushed(FolderDeleteEntity::class);
}

/** @test */
Expand Down

0 comments on commit 6d8b4b3

Please sign in to comment.