You are here

paragraphs_pack_node_list.test in Paragraphs pack 7

File

modules/paragraphs_pack_node_list/tests/paragraphs_pack_node_list.test
View source
<?php

/**
 * @file
 * Paragraphs pack content list module's tests.
 */
module_load_include('inc', 'paragraphs_pack', 'tests/paragraphs_pack.test_helper');

/**
 * class ParagraphsPackNodeListTestCase
 *
 * Test case for Paragraphs pack content list.
 */
class ParagraphsPackNodeListTestCase extends ParagraphsPackWebTestCase {

  /**
   * Give display information to the SimpleTest system.
   *
   * getInfo() returns a keyed array of information for SimpleTest to show.
   *
   * It's a good idea to organize your tests consistently using the 'group'
   * key.
   */
  public static function getInfo() {
    return array(
      'name' => 'Paragraphs pack content list tests',
      'description' => 'Tests:  Paragraphs pack content list installation.',
      'group' => 'Paragraphs pack',
    );
  }

  /**
   * Set up the test environment.
   */
  public function setUp() {

    // We call parent::setUp() with the list of modules we want to enable.
    parent::setUp('paragraphs_pack_node_list');
  }

  /**
   * Test Paragraph Content bundle existence.
   */
  public function testParagraphsPackNodeListBundle() {
    $this
      ->check_bundle_existence(PP_BUNDLE_NODE_LIST);

    // TODO:
    // Assigning paragraph_item to Basic page bundle.
    // Create Basic page node: $this->drupalCreateNode($settings)
    // Load the page for adding new Basic page: $this->drupalGet($path)
    // Select paragraph bundle (probably not necessary, just one paragraph bundle will be available)
    // Click Add Paragraph button: $this->drupalPostAJAX($path, $edit, $triggering_element)
    // Get view mode field options: $this->getAllOptions($element)
    // Check the options.
    // Maybe:
    // Create some nodes, Basic page bundles.
    // Create PP_BUNDLE_NODE_LIST instance.
  }

  /**
   * Test fields and instances existence.
   */
  public function testParagraphsPackNodeListFieldsExistence() {
    $field_items_name = PP_FIELD_ITEMS . '_node';
    $this
      ->check_field_existence(PP_FIELD_TITLE, PP_BUNDLE_NODE_LIST);
    $this
      ->check_field_existence($field_items_name, PP_BUNDLE_NODE_LIST);
    $this
      ->check_field_existence(PP_FIELD_VIEW_MODE, PP_BUNDLE_NODE_LIST);
  }

}

/**
 * Class ClassyParagraphsTestCase
 *
 * Ensure that the markup appears.
 */
class ParagraphsPackNodeListTestViewModeCase extends ParagraphsPackFeatureWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Test view mode on content list paragraph',
      'description' => 'Ensure that the view mode works correctly on content list paragraph.',
      'group' => 'Paragraphs pack',
    );
  }
  public function setUp() {
    parent::setUp('paragraphs_pack_test', 'paragraphs_pack_node_list');

    // Log user in.
    $web_user = $this
      ->drupalCreateUser(array(
      'bypass node access',
      'administer content types',
      'administer paragraphs bundles',
    ));
    $this
      ->drupalLogin($web_user);
  }

  /**
   * Test view mode options.
   */
  public function testParagraphsPackNodeListViewModeOptions() {
    $this
      ->check_view_mode_options('node');
  }

}

Classes

Namesort descending Description
ParagraphsPackNodeListTestCase class ParagraphsPackNodeListTestCase
ParagraphsPackNodeListTestViewModeCase Class ClassyParagraphsTestCase