You are here

public function FieldUITest::testHandlerUIAggregation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/Views/FieldUITest.php \Drupal\field\Tests\Views\FieldUITest::testHandlerUIAggregation()

Tests the basic field handler form when aggregation is enabled.

File

core/modules/field/src/Tests/Views/FieldUITest.php, line 95
Contains \Drupal\field\Tests\Views\FieldUITest.

Class

FieldUITest
Tests the UI of the field field handler.

Namespace

Drupal\field\Tests\Views

Code

public function testHandlerUIAggregation() {

  // Enable aggregation.
  $edit = array(
    'group_by' => '1',
  );
  $this
    ->drupalPostForm('admin/structure/views/nojs/display/test_view_fieldapi/default/group_by', $edit, t('Apply'));
  $url = "admin/structure/views/nojs/handler/test_view_fieldapi/default/field/field_name_0";
  $this
    ->drupalGet($url);
  $this
    ->assertResponse(200);

  // Test the click sort column options.
  // Tests the available formatter options.
  $result = $this
    ->xpath('//select[@id=:id]/option', array(
    ':id' => 'edit-options-click-sort-column',
  ));
  $options = array_map(function ($item) {
    return (string) $item
      ->attributes()->value[0];
  }, $result);
  sort($options, SORT_STRING);
  $this
    ->assertEqual($options, array(
    'format',
    'value',
  ), 'The expected sort field options were found.');
}