class TokenizeAreaUITest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php \Drupal\Tests\views_ui\Functional\TokenizeAreaUITest
- 9 core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php \Drupal\Tests\views_ui\Functional\TokenizeAreaUITest
Tests the token display for the TokenizeAreaPluginBase UI.
@group views_ui
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\views\Functional\ViewTestBase uses ViewResultAssertionTrait
- class \Drupal\Tests\views_ui\Functional\UITestBase
- class \Drupal\Tests\views_ui\Functional\TokenizeAreaUITest
- class \Drupal\Tests\views_ui\Functional\UITestBase
- class \Drupal\Tests\views\Functional\ViewTestBase uses ViewResultAssertionTrait
Expanded class hierarchy of TokenizeAreaUITest
See also
\Drupal\views\Plugin\views\area\Entity
File
- core/
modules/ views_ui/ tests/ src/ Functional/ TokenizeAreaUITest.php, line 14
Namespace
Drupal\Tests\views_ui\FunctionalView source
class TokenizeAreaUITest extends UITestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'entity_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests that the right tokens are shown as available for replacement.
*/
public function testTokenUI() {
$entity_test = EntityTest::create([
'bundle' => 'entity_test',
]);
$entity_test
->save();
$default = $this
->randomView([]);
$id = $default['id'];
$view = View::load($id);
$this
->drupalGet($view
->toUrl('edit-form'));
// Add a global NULL argument to the view for testing argument tokens.
$this
->drupalGet("admin/structure/views/nojs/add-handler/{$id}/page_1/argument");
$this
->submitForm([
'name[views.null]' => 1,
], 'Add and configure contextual filters');
$this
->submitForm([], 'Apply');
$this
->drupalGet("admin/structure/views/nojs/add-handler/{$id}/page_1/header");
$this
->submitForm([
'name[views.area]' => 'views.area',
], 'Add and configure header');
// Test that field tokens are shown.
$this
->assertSession()
->pageTextContains('{{ title }} == Content: Title');
// Test that argument tokens are shown.
$this
->assertSession()
->pageTextContains('{{ arguments.null }} == Global: Null title');
}
}