diff --git a/core/modules/help_topics/tests/src/Functional/HelpTopicTest.php b/core/modules/help_topics/tests/src/Functional/HelpTopicTest.php index 769850a16e..2e54274174 100644 --- a/core/modules/help_topics/tests/src/Functional/HelpTopicTest.php +++ b/core/modules/help_topics/tests/src/Functional/HelpTopicTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\help_topics\Functional; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; use Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait; /** @@ -12,6 +13,7 @@ */ class HelpTopicTest extends BrowserTestBase { use AssertBreadcrumbTrait; + use AssertPageCacheContextsAndTagsTrait; /** * Modules to enable. @@ -166,9 +168,7 @@ protected function verifyHelp($response = 200) { $name = $info['name']; $session->titleEquals($name . ' | Drupal'); $session->responseContains('

' . $name . '

'); - foreach ($info['tags'] as $tag) { - $session->responseHeaderContains('X-Drupal-Cache-Tags', $tag); - } + $this->assertCacheTags($info['tags']); } } } diff --git a/core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php b/core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php index f014c09499..cf4b8c61c8 100644 --- a/core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php +++ b/core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php @@ -26,7 +26,7 @@ class HelpTopicTwigLoaderTest extends UnitTestCase { * * @var array */ - protected static $directories; + protected $directories; /** * {@inheritdoc} @@ -47,8 +47,8 @@ public function testConstructor() { // and non-existent directories were omitted. $paths = $this->helpLoader->getPaths(HelpTopicTwigLoader::MAIN_NAMESPACE); $this->assertEquals(count($paths), 2); - $this->assertTrue(in_array(self::$directories['module']['test'] . '/help_topics', $paths)); - $this->assertTrue(in_array(self::$directories['theme']['test'] . '/help_topics', $paths)); + $this->assertTrue(in_array($this->directories['module']['test'] . '/help_topics', $paths)); + $this->assertTrue(in_array($this->directories['theme']['test'] . '/help_topics', $paths)); } /** @@ -56,6 +56,9 @@ public function testConstructor() { * * @param string $type * Type of handler to return: 'module' or 'theme'. + * + * @return \PHPUnit\Framework\MockObject\MockObject + * The mock of module or theme handler. */ protected function getHandlerMock($type) { if ($type == 'module') { @@ -74,7 +77,7 @@ protected function getHandlerMock($type) { $handler ->method($method) - ->willReturn($this::$directories[$type]); + ->willReturn($this->directories[$type]); return $handler; } @@ -99,7 +102,7 @@ protected function setUpVfs() { ], ]); - self::$directories = [ + $this->directories = [ 'root' => vfsStream::url('root'), 'module' => [ 'test' => vfsStream::url('root/modules/test'),