class AdminNegotiatorTest in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php \Drupal\Tests\user\Unit\Theme\AdminNegotiatorTest
- 10 core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php \Drupal\Tests\user\Unit\Theme\AdminNegotiatorTest
Tests AdminNegotiator class.
@group user @coversDefaultClass \Drupal\user\Theme\AdminNegotiator
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, PhpUnitCompatibilityTrait, PhpUnitWarnings
- class \Drupal\Tests\user\Unit\Theme\AdminNegotiatorTest
Expanded class hierarchy of AdminNegotiatorTest
File
- core/
modules/ user/ tests/ src/ Unit/ Theme/ AdminNegotiatorTest.php, line 18
Namespace
Drupal\Tests\user\Unit\ThemeView source
class AdminNegotiatorTest extends UnitTestCase {
/**
* @dataProvider getThemes
*/
public function testDetermineActiveTheme($admin_theme, $expected) {
$user = $this
->prophesize(AccountInterface::class);
$config_factory = $this
->getConfigFactoryStub([
'system.theme' => [
'admin' => $admin_theme,
],
]);
$entity_type_manager = $this
->prophesize(EntityTypeManagerInterface::class);
$admin_context = $this
->prophesize(AdminContext::class);
$negotiator = new AdminNegotiator($user
->reveal(), $config_factory, $entity_type_manager
->reveal(), $admin_context
->reveal());
$route_match = $this
->prophesize(RouteMatch::class);
$this
->assertSame($expected, $negotiator
->determineActiveTheme($route_match
->reveal()));
}
/**
* Provides a list of theme names to test.
*/
public function getThemes() {
return [
[
'seven',
'seven',
],
[
NULL,
NULL,
],
[
'',
NULL,
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AdminNegotiatorTest:: |
public | function | Provides a list of theme names to test. | |
AdminNegotiatorTest:: |
public | function | @dataProvider getThemes | |
PhpUnitWarnings:: |
private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | |
PhpUnitWarnings:: |
public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 308 | |
UnitTestCase:: |
public static | function |