You are here

public function EntityFieldQueryViewsFieldTest::testFields in EntityFieldQuery Views Backend 8

File

src/Tests/EntityFieldQueryFieldTest.php, line 40
Tests for EFQ Views query features.

Class

EntityFieldQueryViewsFieldTest
Class EntityFieldQueryViewsFieldTestCase

Namespace

Drupal\efq_views\Tests

Code

public function testFields() {
  $this
    ->runView();
  $entity = $this->entities[0];
  $this
    ->assertPattern("/Entity ID: +{$entity->eid}/", 'Entity ID found');
  $this
    ->assertPattern("/Efq views test ID: +{$entity->eid}/", 'Entity ID (meta) found');
  $this
    ->assertPattern("/Test_boolean: +Yes/", 'Boolean found');
  $this
    ->assertPattern('/Test_decimal: +' . $entity->test_decimal / 100 . '/', 'Decimal found');
  $this
    ->assertPattern('/Test_date: +' . preg_quote(format_date($entity->test_date), '/') . '/', 'Date found');
  $this
    ->assertPattern('/Test_text: +test text/', 'Test text found');
  $url = url("custom/{$entity->uid}", array(
    'absolute' => TRUE,
  ));
  $this
    ->assertPattern('/URL: +' . preg_quote(l($url, $url), '/') . '/', 'URL found');
  $this
    ->assertPattern('/field boolean: +On/', 'Boolean field API field found');
  $this
    ->assertPattern('/Bundle: +' . $entity->ebundle . '/', 'Bundle field found');
  $this
    ->assertPattern('/Bundle label: +' . preg_quote(t('Bundle 1'), '/') . '/', 'Bundle label field found');
  $this
    ->assertPattern('/Label: +' . preg_quote($entity->elabel, '/') . '/', 'Label field found');
}