Skip to content

[ci] Run AddDoesNotPerformAssertionToNonAssertingTestRector on Drupal core and its tests - #832

Merged
TomasVotruba merged 2 commits into
mainfrom
drupal-does-not-perform-assertion-ci
Nov 15, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
drupal-does-not-perform-assertion-ci

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Adds standalone Drupal job to guard recent AddDoesNotPerformAssertionToNonAssertingTestRector changes (#824, #825, #826) on real-world code.

Steps:

  • checkout Drupal core (pinned SHA, PHP 8.5, zend.assertions=1)
  • run the rule on core/tests + core/modules
  • run full Drupal unit suite
  • run only the Kernel test files Rector changed (sqlite, parallel) - fails on any "not expected to perform assertions" / "did not perform any assertions" risky test

Functional/FunctionalJavascript tests are skipped, they need web server/Chrome.

Current state - expected red

Locally on the pinned Drupal SHA: 40 files changed, unit suite green, but 29 kernel tests turn risky, e.g.

Drupal\Tests\layout_builder\Kernel\LayoutBuilderBreadcrumbAlterTest::testBreadcrumbAlterNullRouteMatch
This test is not expected to perform assertions but performed 4 assertions

Causes, to be fixed in separate PRs:

  • assertions in setUp() / assertPostConditions() / tearDown() and their helper chains count for the test (e.g. UserCreationTrait::createUser() asserts)
  • dynamic method name call $this->$stream_assert(...) (ExtensionStreamTest)
  • overridden assertPostConditions() with asserts in the test class (KernelTestBaseShutdownTest)

@TomasVotruba

Copy link
Copy Markdown
Member Author

Lets address this here in one place @bbrala 👍

@TomasVotruba
TomasVotruba force-pushed the drupal-does-not-perform-assertion-ci branch 2 times, most recently from 696394a to 867dde3 Compare November 14, 2026 21:00
@TomasVotruba
TomasVotruba force-pushed the drupal-does-not-perform-assertion-ci branch from 867dde3 to be6e998 Compare November 14, 2026 23:58
@TomasVotruba
TomasVotruba merged commit 4ce55dc into main Nov 15, 2026
15 checks passed
@TomasVotruba
TomasVotruba deleted the drupal-does-not-perform-assertion-ci branch November 15, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant