Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117893591
D5250.1775367678.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D5250.1775367678.diff
View Options
diff --git a/src/app/Jobs/Domain/DeleteJob.php b/src/app/Jobs/Domain/DeleteJob.php
--- a/src/app/Jobs/Domain/DeleteJob.php
+++ b/src/app/Jobs/Domain/DeleteJob.php
@@ -20,13 +20,13 @@
}
// sanity checks
- if ($domain->trashed()) {
- $this->fail("Domain {$this->domainId} is not deleted.");
+ if (!$domain->trashed()) {
+ $this->fail("Domain {$domain->namespace} is not deleted.");
return;
}
if ($domain->isDeleted()) {
- $this->fail("Domain {$this->domainId} is already marked as deleted.");
+ $this->fail("Domain {$domain->namespace} is already marked as deleted.");
return;
}
diff --git a/src/tests/Feature/Jobs/Domain/DeleteTest.php b/src/tests/Feature/Jobs/Domain/DeleteTest.php
--- a/src/tests/Feature/Jobs/Domain/DeleteTest.php
+++ b/src/tests/Feature/Jobs/Domain/DeleteTest.php
@@ -36,21 +36,33 @@
]
);
- \config(['app.with_ldap' => true]);
+ // Test job failure (domain not trashed)
+ $job = (new DeleteJob($domain->id))->withFakeQueueInteractions();
+ $job->handle();
+ $job->assertFailedWith("Domain {$domain->namespace} is not deleted.");
+
+ // Test job success
+ $domain->deleted_at = \now();
+ $domain->saveQuietly();
$this->assertTrue($domain->isLdapReady());
+ $this->assertTrue($domain->trashed());
$this->assertFalse($domain->isDeleted());
- LDAP::shouldReceive('deleteDomain')->once()->with($domain)->andReturn(true);
+ \config(['app.with_ldap' => true]);
+ LDAP::shouldReceive('deleteDomain')->once()->with($domain);
- $job = new DeleteJob($domain->id);
+ $job = (new DeleteJob($domain->id))->withFakeQueueInteractions();
$job->handle();
+ $job->assertNotFailed();
$domain->refresh();
$this->assertFalse($domain->isLdapReady());
$this->assertTrue($domain->isDeleted());
- // TODO: More cases
- $this->markTestIncomplete();
+ // Test job failure (domain marked as deleted)
+ $job = (new DeleteJob($domain->id))->withFakeQueueInteractions();
+ $job->handle();
+ $job->assertFailedWith("Domain {$domain->namespace} is already marked as deleted.");
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 5:41 AM (2 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18806652
Default Alt Text
D5250.1775367678.diff (2 KB)
Attached To
Mode
D5250: Fix domain delete job
Attached
Detach File
Event Timeline