You are here

public function ConditionTest::testAnd in Apigee Edge 8

Tests the "AND" conjunction.

File

tests/src/Unit/ConditionTest.php, line 108

Class

ConditionTest
Entity query condition tests.

Namespace

Drupal\Tests\apigee_edge\Unit

Code

public function testAnd() {
  $data = $this
    ->randomData();
  $value0 = $data[0];
  $value1 = $data[1];
  $cond = $this
    ->mockCondition();
  $cond
    ->condition('id', $value0);
  $cond
    ->condition('foo_bar', $value1);
  $this
    ->assertFilters($cond, function (EntityInterface $item) use ($value0, $value1) : bool {
    return $item
      ->id() == $value0 && $item
      ->getFooBar() == $value1;
  });
}