You are here

protected function NgLightboxTest::getLightbox in NG Lightbox 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/NgLightboxTest.php \Drupal\Tests\ng_lightbox\Unit\NgLightboxTest::getLightbox()

Get the lightbox service setup for testing.

Return value

\Drupal\ng_lightbox\NgLightbox The lightbox service.

3 calls to NgLightboxTest::getLightbox()
NgLightboxTest::testAdminSkipPaths in tests/src/Unit/NgLightboxTest.php
Test the admin_skip_path settings.
NgLightboxTest::testEmptyPath in tests/src/Unit/NgLightboxTest.php
Test with an empty path.
NgLightboxTest::testExternalUrl in tests/src/Unit/NgLightboxTest.php
Test with an External URL.

File

tests/src/Unit/NgLightboxTest.php, line 68
Contains \Drupal\Tests\ng_lightbox\Unit\NgLightboxTest

Class

NgLightboxTest
@coversDefaultClass \Drupal\ng_lightbox\NgLightbox @group ng_lightbox

Namespace

Drupal\Tests\ng_lightbox\Unit

Code

protected function getLightbox($skip_admin_paths = TRUE, $is_admin_route = TRUE) {
  $path_matcher = $this
    ->prophesize('Drupal\\Core\\Path\\PathMatcherInterface');
  $alias_manager = $this
    ->prophesize('Drupal\\Core\\Path\\AliasManagerInterface');
  $config_factory = $this
    ->prophesize('Drupal\\Core\\Config\\ConfigFactoryInterface');
  $config = $this
    ->prophesize('Drupal\\Core\\Config\\ImmutableConfig');
  $config
    ->get(Argument::exact('skip_admin_paths'))
    ->willReturn($skip_admin_paths);
  $config_factory
    ->get(Argument::exact('ng_lightbox.settings'))
    ->willReturn($config);
  $admin_context = $this
    ->prophesize('Drupal\\Core\\Routing\\AdminContext');
  $admin_context
    ->isAdminRoute()
    ->willReturn($is_admin_route);
  $lightbox = new NgLightbox($path_matcher
    ->reveal(), $alias_manager
    ->reveal(), $config_factory
    ->reveal(), $admin_context
    ->reveal());
  return $lightbox;
}