class NavigationContentTopTest
Same name in this branch
- main core/modules/navigation/tests/src/Functional/NavigationContentTopTest.php \Drupal\Tests\navigation\Functional\NavigationContentTopTest
Same name and namespace in other branches
- 11.x core/modules/navigation/tests/src/Functional/NavigationContentTopTest.php \Drupal\Tests\navigation\Functional\NavigationContentTopTest
Tests for navigation content_top section.
Attributes
#[Group('navigation')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\Tests\DrupalTestCase uses \Drupal\Tests\DrupalTestCaseTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\BrowserHtmlDebugTrait, \Drupal\Tests\HttpKernelUiHelperTrait extends \Drupal\Tests\DrupalTestCase
- class \Drupal\Tests\navigation\Kernel\NavigationContentTopTest uses \Drupal\Tests\user\Traits\UserCreationTrait extends \Drupal\KernelTests\KernelTestBase
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\BrowserHtmlDebugTrait, \Drupal\Tests\HttpKernelUiHelperTrait extends \Drupal\Tests\DrupalTestCase
Expanded class hierarchy of NavigationContentTopTest
File
-
core/
modules/ navigation/ tests/ src/ Kernel/ NavigationContentTopTest.php, line 18
Namespace
Drupal\Tests\navigation\KernelView source
class NavigationContentTopTest extends KernelTestBase {
use UserCreationTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'navigation',
'navigation_test',
'test_page_test',
'user',
'system',
'layout_builder',
'layout_discovery',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->installConfig('navigation');
$this->installEntitySchema('user');
$this->setCurrentUser($this->createUser([
'access navigation',
]));
}
/**
* Tests behavior of content_top section hooks.
*/
public function testNavigationContentTop() : void {
$test_page_url = Url::fromRoute('test_page_test.test_page');
$this->drupalGet($test_page_url);
$this->assertSession()
->elementNotExists('css', '.admin-toolbar__content-top');
\Drupal::keyValue('navigation_test')->set('content_top', 1);
Cache::invalidateTags([
'navigation_test',
]);
$this->drupalGet($test_page_url);
$this->assertSession()
->elementTextContains('css', '.admin-toolbar__content-top', 'foobarbaz');
\Drupal::keyValue('navigation_test')->set('content_top_alter', 1);
Cache::invalidateTags([
'navigation_test',
]);
$this->drupalGet($test_page_url);
$this->assertSession()
->elementTextContains('css', '.admin-toolbar__content-top', 'baznew bar');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.