Skip to content

Commit

Permalink
MNT Fix unit test in kitchen sink
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Oct 3, 2023
1 parent fb99980 commit a625085
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/php/RunDeleteCacheJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SilverStripe\StaticPublishQueue\Job;

use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Subsites\State\SubsiteState;
use Symbiote\QueuedJobs\Services\QueuedJobService;

class RunDeleteCacheJobTest extends FunctionalTest
Expand All @@ -12,7 +13,14 @@ public function testHydrationAffectsSignature()
$job = new DeleteStaticCacheJob();
$data = $job->getJobData();
$signature = $job->getSignature();
$this->assertEmpty($data->jobData);
if (class_exists(SubsiteState::class)) {
// The subsite ID is added via `AbstractQueuedJob::getJobData()`
// Without accounting for that, this test fails in the kitchen sink.
$expected = ['SubsiteID' => SubsiteState::singleton()->getSubsiteId()];
$this->assertSame($expected, json_decode(json_encode($data->jobData), true));
} else {
$this->assertEmpty($data->jobData);
}
$this->assertFalse($data->isComplete);

$job->hydrate(['/' => 1], null);
Expand Down

0 comments on commit a625085

Please sign in to comment.