function FieldUITest::testHandlerUIAggregation

Same name in other branches
  1. 9 core/modules/field/tests/src/Functional/Views/FieldUITest.php \Drupal\Tests\field\Functional\Views\FieldUITest::testHandlerUIAggregation()
  2. 10 core/modules/field/tests/src/Functional/Views/FieldUITest.php \Drupal\Tests\field\Functional\Views\FieldUITest::testHandlerUIAggregation()
  3. 11.x core/modules/field/tests/src/Functional/Views/FieldUITest.php \Drupal\Tests\field\Functional\Views\FieldUITest::testHandlerUIAggregation()

Tests the basic field handler form when aggregation is enabled.

File

core/modules/field/tests/src/Functional/Views/FieldUITest.php, line 107

Class

FieldUITest
Tests the UI of the field field handler.

Namespace

Drupal\Tests\field\Functional\Views

Code

public function testHandlerUIAggregation() {
    // Enable aggregation.
    $edit = [
        '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->assertSession()
        ->statusCodeEquals(200);
    // Test the click sort column options.
    // Tests the available formatter options.
    $result = $this->xpath('//select[@id=:id]/option', [
        ':id' => 'edit-options-click-sort-column',
    ]);
    $options = array_map(function ($item) {
        return (string) $item->getAttribute('value');
    }, $result);
    sort($options, SORT_STRING);
    $this->assertEqual($options, [
        'format',
        'value',
    ], 'The expected sort field options were found.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.