Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT Fix unit test in kitchen sink #174

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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