You are here

protected function QueryTest::developerQueryTest in Apigee Edge 8

Tests developer entity queries.

1 call to QueryTest::developerQueryTest()
QueryTest::testQueries in tests/src/Functional/QueryTest.php
Tests developer and developer app entity queries.

File

tests/src/Functional/QueryTest.php, line 134

Class

QueryTest
Developer and developer app entity query test.

Namespace

Drupal\Tests\apigee_edge\Functional

Code

protected function developerQueryTest() {
  $result = $this->developerStorage
    ->getQuery()
    ->condition('email', "{$this->prefix}.test", 'STARTS_WITH')
    ->condition('email', '@example.com', 'ENDS_WITH')
    ->sort('lastName')
    ->sort('email', 'DESC')
    ->execute();
  $this
    ->assertEquals(array_values([
    "{$this->prefix}.test02@example.com",
    "{$this->prefix}.test01@example.com",
    "{$this->prefix}.test00@example.com",
  ]), array_values($result));
  $result = $this->developerStorage
    ->getQuery()
    ->condition('email', "{$this->prefix}.test", 'STARTS_WITH')
    ->condition('email', '@example.com', 'ENDS_WITH')
    ->sort('email')
    ->range(1, 1)
    ->execute();
  $this
    ->assertEquals(array_values([
    "{$this->prefix}.test01@example.com",
  ]), array_values($result));
  $result = $this->developerStorage
    ->getQuery()
    ->condition('email', "{$this->prefix}.test", 'STARTS_WITH')
    ->condition('email', '@example.com', 'ENDS_WITH')
    ->count()
    ->execute();
  $this
    ->assertEquals(3, $result);
}