You are here

protected function ContentHubUserSessionTest::setUp in Acquia Content Hub 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/Session/ContentHubUserSessionTest.php, line 42

Class

ContentHubUserSessionTest
PHPUnit test for the ContentHubUserSession class.

Namespace

Drupal\Tests\acquia_contenthub\Unit\Session

Code

protected function setUp() {
  $this->configFactory = $this
    ->createMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
  $this->configFactory
    ->method('get')
    ->willReturnCallback(function ($argument) {
    if ($argument == 'acquia_contenthub.entity_config') {
      $contenthub_entity_config = $this
        ->getMockBuilder('Drupal\\Core\\Config\\ImmutableConfig')
        ->disableOriginalConstructor()
        ->setMethods([
        'get',
      ])
        ->getMockForAbstractClass();
      $contenthub_entity_config
        ->method('get')
        ->willReturnCallback(function ($argument) {
        if ($argument == 'user_role') {
          return $this->userRole;
        }
        return NULL;
      });
      return $contenthub_entity_config;
    }
    return NULL;
  });
}