Problem/Motivation

One of the test assertions introduced in #2443679: PostgreSQL: Fix taxonomy\Tests\TermTest to EntityQueryTest is tautologic, i.e. it will always pass, even if the underlying code is broken again.

EntityQueryTest::assertResult() works with $this->queryResults so in order for it to work correctly, you previously need to do $this->queryResults = $query->execute();. This is missed in one case. Because the assertion following this is identical to the previous assertion it passes, because it works with the previous query results.

Proposed resolution

Change the following lines (starting 225) in core/modules/system/src/Tests/Entity/EntityQueryTest.php:

    $query
      ->condition($group_blue)
      ->condition($group_red)
      ->sort('id')
      ->execute();

to

    $this->queryResults = $query
      ->condition($group_blue)
      ->condition($group_red)
      ->sort('id')
      ->execute();

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Create a patch Instructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards Instructions

User interface changes

None.

API changes

None.

Data model changes

None.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because the test code does not actually test what it wants to test
Issue priority Normal because nothing is functionally broken by this
Unfrozen changes Unfrozen because it only changes tests.
Prioritized changes Prioritized because it is a bug
Disruption No disruption

Comments

chx’s picture

Issue tags: -undefined +Novice
yesct’s picture

Issue summary: View changes

adding links to contributor task documents (note the dreditor insert tasks button is great to help automate adding links to tasks documents)

sdstyles’s picture

StatusFileSize
new566 bytes

Created the patch

borisson_’s picture

Status: Active » Needs review

Setting issue status to needs review, so the testbot can verify this.

tstoeckler’s picture

Status: Needs review » Needs work

@sdstyles: Can you roll the patch again from the root of the Drupal repository?

--- a/EntityQueryTest.php
+++ b/EntityQueryTest.php

These lines should look like

--- a/core/modules/system/src/Tests/Entity/EntityQueryTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityQueryTest.php

Fore more information see https://www.drupal.org/patch/create

sdstyles’s picture

StatusFileSize
new714 bytes

Re-rolled #3

sdstyles’s picture

Status: Needs work » Needs review

The last submitted patch, 3: broken-assertion-2528160-3.patch, failed testing.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the quick reroll, this looks great.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 3bc6dc1 and pushed to 8.0.x. Thanks!

Postgres still passes.

  • alexpott committed 3bc6dc1 on 8.0.x
    Issue #2528160 by sdstyles, tstoeckler: Broken assertion introduced in #...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.