public function ComponentsLoaderTest::testSetActiveThemeCache in Components! 8.2
Tests the use of the active theme cache.
@covers ::setActiveTheme
Throws
File
- tests/
src/ Unit/ ComponentsLoaderTest.php, line 234
Class
- ComponentsLoaderTest
- @coversDefaultClass \Drupal\components\Template\Loader\ComponentsLoader @group components
Namespace
Drupal\Tests\components\UnitCode
public function testSetActiveThemeCache() {
// Add a path to the sol namespace.
$expected = [
'/sol/templates',
'/test/templates',
];
$this->systemUnderTest
->addPath('/test/templates', 'sol');
$result = $this->systemUnderTest
->getPaths('sol');
$this
->assertEquals($expected, $result);
// The mocked theme manager will swap the active theme twice.
$this->systemUnderTest
->checkActiveTheme();
$this->systemUnderTest
->checkActiveTheme();
// The cache doesn't have the path added earlier.
$expected = [
'/sol/templates',
];
$result = $this->systemUnderTest
->getPaths('sol');
$this
->assertEquals($expected, $result);
}