You are here

function BiblioUiPathAutoTestCase::testBiblioAlias in Bibliography Module 7.3

Tests alias functionality through the Biblio interfaces.

File

modules/biblio_ui/tests/PathAuto.test, line 35
Tests for the integration with the Path auto module.

Class

BiblioUiPathAutoTestCase
Testing pathauto integration.

Code

function testBiblioAlias() {

  // Create test biblio.
  $biblio = biblio_create('book', array(
    'title' => 'Testing',
  ));
  $biblio
    ->save();

  // Confirm that the path generated succesfully.
  $this
    ->drupalGet('biblio/testing');
  $this
    ->assertText($biblio
    ->label(), 'The path was generated succesfully.');
  $this
    ->assertResponse(200);

  // Update the title so we the path will change as well.
  $biblio->title = 'Updated testing';
  $biblio
    ->save();

  // Confirm the alias changed as well.
  $this
    ->drupalGet('biblio/updated-testing');
  $this
    ->assertText($biblio
    ->label(), 'The path was updated succesfully.');
  $this
    ->assertResponse(200);

  // After deleting a biblio the path should be deleted as well.
  $biblio
    ->delete();
  $this
    ->assertFalse(path_load(array(
    'source' => 'biblio/' . $biblio
      ->identifier(),
  ), 'The path was removed after deleting biblio.'));
}