ThemeRegistryLoaderTest.php

Same filename and directory in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php
  2. 10 core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php
  3. 9 core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php
  4. 8.9.x core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php

Namespace

Drupal\Tests\Core\Template\Loader

File

core/tests/Drupal/Tests/Core/Template/Loader/ThemeRegistryLoaderTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Template\Loader;

use Drupal\Core\Template\Loader\ThemeRegistryLoader;
use Drupal\Tests\UnitTestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;

/**
 * Tests Drupal\Core\Template\Loader\ThemeRegistryLoader.
 */
class ThemeRegistryLoaderTest extends UnitTestCase {
  
  /**
   * Tests loader returns false for exists on nonexistent.
   *
   * @legacy-covers ::findTemplate
   */
  public function testLoaderReturnsFalseForExistsOnNonexistent() : void {
    $registry = $this->prophesize('Drupal\\Core\\Theme\\Registry');
    $runtime = $this->prophesize('Drupal\\Core\\Utility\\ThemeRegistry');
    $runtime->has('foo')
      ->shouldBeCalled()
      ->willReturn(FALSE);
    $registry->getRuntime()
      ->willReturn($runtime);
    $loader = new ThemeRegistryLoader($registry->reveal());
    $this->assertFalse($loader->exists('foo'));
  }

}

Classes

Title Deprecated Summary
ThemeRegistryLoaderTest Tests Drupal\Core\Template\Loader\ThemeRegistryLoader.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.