Skip to content

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

Open
TomasVotruba wants to merge 1 commit into
mainfrom
drupal-does-not-perform-assertion-ci
Open

TomasVotruba wants to merge 1 commit 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 👍

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