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 #215

Merged
merged 1 commit into from
Jan 21, 2025
Merged

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Jan 21, 2025

Issue silverstripe/.github#357

Fixes https://github.com/creative-commoners/recipe-kitchen-sink/actions/runs/12879104438/job/35906085673#step:12:105

1) SilverStripe\StaticPublishQueue\Test\Extension\Engine\SiteTreePublishingEngineTest::testStaticPublishingTriggerOnExtension SilverStripe\ORM\Connect\DatabaseException: Couldn't run query: ...

The unit test SiteTreePublishingEngineTest::testStaticPublishingTriggerOnExtension() doesn't exist on the latest minor branch 6.2, so targeting the 6 branch is correct

@emteknetnz emteknetnz marked this pull request as ready for review January 21, 2025 03:51
@@ -24,4 +24,3 @@ public function objectsToDelete($context)
return [];
}
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting fix

@@ -246,7 +250,8 @@ public function testStaticPublishingTriggerOnExtension(): void
/** @var QueuedJobsTestService $service */
$service = QueuedJobService::singleton();

$dataObject = DataObjectNoTrigger::create()->write();
$dataObject = DataObjectNoTrigger::create();
$dataObject->write();
Copy link
Member Author

@emteknetnz emteknetnz Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->write() returns an int, so we cannot chain it

I have no idea how this unit test used to pass

@@ -7,9 +7,10 @@

class DataObjectNoTrigger extends DataObject implements TestOnly
{
private static $table_name = 'StaticPublishQueue_DataObjectNoTrigger';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created silverstripe/silverstripe-standards#15 to add a phpstan rule to resolve these going forward

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. wild that this wasn't failing before.

@GuySartorelli GuySartorelli merged commit 1da13bc into silverstripe:6 Jan 21, 2025
9 checks passed
@GuySartorelli GuySartorelli deleted the pulls/6/fix-test branch January 21, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants