You are here

fpp.with_pathauto.test in Fieldable Panels Panes (FPP) 7

Tests for the Fieldable Panels Panes module with Pathauto.

File

tests/fpp.with_pathauto.test
View source
<?php

/**
 * @file
 * Tests for the Fieldable Panels Panes module with Pathauto.
 */

/**
 * Tests for the Fieldable Panels Panes module with Pathauto.
 */
class FppWithPathautoTest extends FppTestHelper {

  /**
   * {@inheritdoc}
   */
  public static function getInfo() {
    return array(
      'name' => 'FPP tests for Pathauto',
      'description' => 'Confirm that FPP does not break when using Pathauto.',
      'group' => 'FPP',
      'dependencies' => array(
        'ctools',
        'panels',
        'views',
        'pathauto',
      ),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function setUp(array $modules = array()) {
    $modules[] = 'pathauto';
    parent::setUp($modules);
  }

  /**
   * Test the Pathauto integration.
   */
  public function testPathauto() {

    // Create a test node.
    $node = $this
      ->drupalCreateNode();

    // Create a user with the admin permission.
    $permissions = array(
      "create fieldable {$this->bundle}",
      'view the administration theme',
    );
    $this->user = $this
      ->createUser($permissions);
    $this
      ->drupalLogin($this->user);

    // Load the 'add' page.
    $this
      ->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/add');
    $this
      ->assertResponse(200, 'Loaded the Add page for the default FPP type.');

    // Save the record with a path that points to the node.
    $args = array(
      'title' => t('Test'),
      'link' => TRUE,
      'path' => 'node/1',
    );
    $this
      ->drupalPost(NULL, $args, t('Save'));
    $this
      ->assertResponse(200);
    $this
      ->assertText(t('The entity has been saved.'));

    // Confirm the record was saved.
    $this
      ->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle);
    $this
      ->assertNoText(t('There are currently no entities of this type.'));

    // Try loading it.
    $this
      ->drupalGet('admin/structure/fieldable-panels-panes/view/1');
    $this
      ->assertResponse(200, 'Loaded the FPP object.');

    // Load the FPP.
    $fpp = fieldable_panels_panes_load(1);

    // Confirm there's a link with the FPP's title and the node's URL.
    $this
      ->assertRaw(l($fpp->title, 'node/' . $node->nid));
  }

}

Classes

Namesort descending Description
FppWithPathautoTest Tests for the Fieldable Panels Panes module with Pathauto.