You are here

public function NgLightboxTest::testPatternMatching in NG Lightbox 7

Test the pattern matching for link paths.

File

tests/ng_lightbox.test, line 132
NG Lightbox tests.

Class

NgLightboxTest
@file NG Lightbox tests.

Code

public function testPatternMatching() {

  // Disable this since we'll technically be in the admin batch runner.
  variable_set('ng_lightbox_skip_admin_paths', FALSE);

  // Create a node to link to and add an alias for the node.
  $alias = $this
    ->randomName();
  $node1 = $this
    ->drupalCreateNode(array(
    'path' => array(
      'alias' => $alias,
    ),
  ));

  // Only setting the aliased path should still match.
  variable_set('ng_lightbox_patterns', $alias);
  $this
    ->assertContains('ng-lightbox', l('Normal Path', 'node/' . $node1->nid));

  // The uppercase path should still be matched for a lightbox.
  $this
    ->assertContains('ng-lightbox', l('Uppercase Path', 'NODE/' . $node1->nid));

  // The link with the path alias also works.
  $this
    ->assertContains('ng-lightbox', l('Aliased Path', $alias));

  // The link with the empty path should never be matched.
  $this
    ->assertNotContains('ng-lightbox', l('Empty Path', ''));
}