Entity query test: Method call is provided 2 parameters, but the method signature uses 1 parameters

Created on 8 March 2024, 4 months ago
Updated 22 March 2024, 3 months ago

Problem/Motivation

In AlternativeUserEmailsQueryTest.php:

    $this->query = \Drupal::entityQuery('user')
      ->accessCheck(FALSE)
      ->condition('name', ['john', 'fred'], 'IN');
    $or = $this->query->orConditionGroup();
    $or->condition('mail', 'john@example.com');
    $or->condition('mail', 'jane@example.com');
    $this->query->condition($or);
    $this->assertResults([$john], $this->query);

The final line assertResults() is incorrect because assertResults() only takes one argument.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΅Japan ptmkenny

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @ptmkenny
  • Merge request !14remove second parameter β†’ (Merged) created by ptmkenny
  • πŸ‡―πŸ‡΅Japan ptmkenny

    I removed the second parameter call for now, but reading through the test, I don't know what the intention of this particular test item is.

    Is it: "If you have two names and two email addresses, but only one name and email are a match, then you should only get that one name and email as a result?" The other tests are pretty clear, so it may be helpful to add a comment to this one.

    It's especially confusing as this appears to be the only place where the "$jane" user is used.

  • Assigned to jonathanshaw
  • Status changed to Needs review 4 months ago
  • πŸ‡¬πŸ‡§United Kingdom jonathanshaw Stroud, UK

    You're right to remove the second param.

    The test seems to be is looking at what happens when there are 3 users, 2 caught by one condition, 2 caught by an or group, but only 1 caught by both.

    I suspect there's no great logic to which things get tested here - the query altering is pretty hairy stuff, so I probably justed a whole bunch of ways of querying stuff in a shotgun approach and hoped I tested what I needed to.

  • Issue was unassigned.
  • Status changed to Active 4 months ago
  • Pipeline finished with Skipped
    4 months ago
    #114965
    • ptmkenny β†’ committed 50fe7d1c on 1.0.x
      Issue #3426566 by ptmkenny, jonathanshaw: Entity query test: Method call...
  • Status changed to Fixed 4 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024