From a8814038a491e482f14586b1ed26cacbd5e8e593 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 3 Oct 2023 15:26:17 +1300 Subject: [PATCH] MNT Fix unit test in kitchen sink --- tests/php/RunDeleteCacheJobTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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);