You are here

public function RolebasedTest::testStub in Role Based Theme Switcher 8

Same name and namespace in other branches
  1. 9.1.x tests/src/Unit/RolebasedTest.php \Drupal\Tests\role_based_theme_switcher\Unit\RolebasedTest::testStub()

File

tests/src/Unit/RolebasedTest.php, line 19

Class

RolebasedTest
Test for Role check.

Namespace

Drupal\Tests\role_based_theme_switcher\Unit

Code

public function testStub() {
  $role = [
    'authenticated',
    'administrator',
  ];

  // Create a stub for the SomeClass class.
  $stub = $this
    ->getMockBuilder('Drupal\\role_based_theme_switcher\\Theme\\RoleNegotiator')
    ->disableOriginalConstructor()
    ->setMethods([
    'getPriorityRole',
  ])
    ->getMock();
  $stub
    ->expects($this
    ->once())
    ->method('getPriorityRole')
    ->with($this
    ->equalTo($role));

  // Configure the stub.
  $stub
    ->getPriorityRole($role);
}