diff --git a/tests/php/RunDeleteCacheJobTest.php b/tests/php/RunDeleteCacheJobTest.php index bfa7519f..a272be84 100644 --- a/tests/php/RunDeleteCacheJobTest.php +++ b/tests/php/RunDeleteCacheJobTest.php @@ -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 @@ -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);