function PluginBaseTest::testGetAvailableGlobalTokens
Same name and namespace in other branches
- main core/modules/views/tests/src/Unit/PluginBaseTest.php \Drupal\Tests\views\Unit\PluginBaseTest::testGetAvailableGlobalTokens()
Tests the getAvailableGlobalTokens method.
Attributes
#[DataProvider('providerTestGetAvailableGlobalTokens')]
File
-
core/
modules/ views/ tests/ src/ Unit/ PluginBaseTest.php, line 42
Class
Namespace
Drupal\Tests\views\UnitCode
public function testGetAvailableGlobalTokens($info, $types, $expected) : void {
// Get the token service and set the container.
$token = $this->createStub(Token::class);
$token->method('getInfo')
->willReturn($info);
$container = new ContainerBuilder();
$container->set('token', $token);
\Drupal::setContainer($container);
$prepared = FALSE;
$actual = $this->testHelperPlugin
->getAvailableGlobalTokens($prepared, $types);
$this->assertEquals($expected, $actual);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.