Skip to content

test(workflowengine): add tests for RuleMatcher - #60502

Merged
provokateurin merged 2 commits into
masterfrom
fix/add-rulematcher-test
Dec 5, 2026
Merged

provokateurin merged 2 commits into
masterfrom
fix/add-rulematcher-test

Conversation

@salmart-dev

@salmart-dev salmart-dev commented May 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Separate PR to avoid review churn, based upon the changes of #59966. Adds a test for RuleMatcher for the workflowengine app,

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@salmart-dev salmart-dev added this to the Nextcloud 34 milestone May 18, 2026
@salmart-dev salmart-dev self-assigned this May 18, 2026
@salmart-dev salmart-dev added the 3. to review Waiting for reviews label May 18, 2026
@salmart-dev

Copy link
Copy Markdown
Contributor Author

/backport to stable34 please

Base automatically changed from feature/workflow-app-rules to master May 18, 2026 14:52
@salmart-dev
salmart-dev marked this pull request as ready for review May 18, 2026 16:25
@salmart-dev
salmart-dev requested a review from a team as a code owner May 18, 2026 16:25
@salmart-dev
salmart-dev requested review from ArtificialOwl, come-nc, leftybournes and provokateurin and removed request for a team May 18, 2026 16:25
Comment on lines +70 to +92
$this->expectException(RuntimeException::class);
$this->ruleMatcher->setOperation($this->operation);
}

public function testSetEntityThrowsIfCalledTwice(): void {
$this->ruleMatcher->setEntity($this->entity);
$this->expectException(RuntimeException::class);
$this->ruleMatcher->setEntity($this->entity);
}

public function testSetEventNameThrowsIfCalledTwice(): void {
$this->ruleMatcher->setEventName('MyEvent');
$this->expectException(RuntimeException::class);
$this->ruleMatcher->setEventName('MyEvent');
}

public function testGetEntityThrowsIfNotSet(): void {
$this->expectException(LogicException::class);
$this->ruleMatcher->getEntity();
}

public function testGetFlowsThrowsIfOperationNotSet(): void {
$this->expectException(RuntimeException::class);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO you should check for the error message itself. Otherwise something else could throw the exception and you wouldn't notice it in the tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines +270 to +278
$this->expectException(UnexpectedValueException::class);
$this->ruleMatcher->check(['class' => \stdClass::class, 'operator' => 'is', 'value' => 'x']);
}

public function testCheckWithFileCheckThrowsWithoutFileInfo(): void {
$checkInstance = $this->createMock(IFileCheck::class);
$this->container->method('get')->willReturn($checkInstance);

$this->expectException(RuntimeException::class);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

This was referenced Jun 5, 2026
@susnux susnux added the community pull requests from community label Jun 9, 2026
@susnux susnux modified the milestones: Nextcloud 34.0.1, Nextcloud 35 Jun 9, 2026
@come-nc come-nc removed the community pull requests from community label Jun 11, 2026
This was referenced Aug 12, 2026
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 20, 2026
@skjnldsv skjnldsv mentioned this pull request Aug 25, 2026
@salmart-dev

Copy link
Copy Markdown
Contributor Author

/backport to stable35

@provokateurin provokateurin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Formatting needs fixing.

salmart-dev and others added 2 commits December 5, 2026 22:55
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
Keeps the new tests in line with the strict rector and php-cs-fixer
CI checks.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
susnux force-pushed the fix/add-rulematcher-test branch from b0c7630 to b985b07 Compare December 5, 2026 21:57
@provokateurin
provokateurin merged commit 82771b8 into master Dec 5, 2026
154 checks passed
@provokateurin
provokateurin deleted the fix/add-rulematcher-test branch December 5, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants