Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Jobs/Group/DeleteTest.php
<?php | <?php | ||||
namespace Tests\Feature\Jobs\Group; | namespace Tests\Feature\Jobs\Group; | ||||
use App\Group; | use App\Group; | ||||
use Illuminate\Support\Facades\Queue; | |||||
use Tests\TestCase; | use Tests\TestCase; | ||||
class DeleteTest extends TestCase | class DeleteTest extends TestCase | ||||
{ | { | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
*/ | */ | ||||
public function setUp(): void | public function setUp(): void | ||||
Show All 23 Lines | public function testHandle(): void | ||||
]); | ]); | ||||
// create to domain first | // create to domain first | ||||
$job = new \App\Jobs\Group\CreateJob($group->id); | $job = new \App\Jobs\Group\CreateJob($group->id); | ||||
$job->handle(); | $job->handle(); | ||||
$this->assertTrue($group->fresh()->isLdapReady()); | $this->assertTrue($group->fresh()->isLdapReady()); | ||||
Queue::fake(); | |||||
$job = new \App\Jobs\Group\DeleteJob($group->id); | $job = new \App\Jobs\Group\DeleteJob($group->id); | ||||
$job->handle(); | $job->handle(); | ||||
$group->refresh(); | $group->refresh(); | ||||
$this->assertFalse($group->isLdapReady()); | $this->assertFalse($group->isLdapReady()); | ||||
$this->assertTrue($group->isDeleted()); | $this->assertTrue($group->isDeleted()); | ||||
/* | |||||
Queue::assertPushed(\App\Jobs\IMAP\AclCleanupJob::class, 1); | |||||
Queue::assertPushed( | |||||
\App\Jobs\IMAP\AclCleanupJob::class, | |||||
function ($job) { | |||||
$ident = TestCase::getObjectProperty($job, 'ident'); | |||||
$domain = TestCase::getObjectProperty($job, 'domain'); | |||||
return $ident == 'group' && $domain === 'kolab.org'; | |||||
} | |||||
); | |||||
*/ | |||||
// Test non-existing group ID | // Test non-existing group ID | ||||
$job = new \App\Jobs\Group\DeleteJob(123); | $job = new \App\Jobs\Group\DeleteJob(123); | ||||
$job->handle(); | $job->handle(); | ||||
$this->assertTrue($job->hasFailed()); | $this->assertTrue($job->hasFailed()); | ||||
$this->assertSame("Group 123 could not be found in the database.", $job->failureMessage); | $this->assertSame("Group 123 could not be found in the database.", $job->failureMessage); | ||||
} | } | ||||
} | } |