You are here

NodeBehaviorInvocationTest.php in Rabbit Hole 2.x

Same filename and directory in other branches
  1. 8 modules/rh_node/tests/src/Functional/NodeBehaviorInvocationTest.php

File

modules/rh_node/tests/src/Functional/NodeBehaviorInvocationTest.php
View source
<?php

namespace Drupal\Tests\rh_node\Functional;

use Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorInvocationTestBase;

/**
 * Test that rabbit hole behaviors are invoked correctly for nodes.
 *
 * @group rh_node
 */
class NodeBehaviorInvocationTest extends RabbitHoleBehaviorInvocationTestBase {

  /**
   * {@inheritdoc}
   */
  protected $entityType = 'node';

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'rh_node',
    'node',
  ];
  const TEST_BUNDLE = 'rh_node_test_content_type';

  /**
   * {@inheritdoc}
   */
  protected function createEntityBundle($action = NULL) {
    $bundle = $this
      ->drupalCreateContentType([
      'type' => self::TEST_BUNDLE,
    ]);
    if (isset($action)) {
      $this->behaviorSettingsManager
        ->saveBehaviorSettings([
        'action' => $action,
        'allow_override' => TRUE,
      ], 'node_type', $bundle
        ->id());
    }
    return $bundle
      ->id();
  }

  /**
   * {@inheritdoc}
   */
  protected function createEntity($action = NULL) {
    $values = [
      'type' => self::TEST_BUNDLE,
    ];
    if (isset($action)) {
      $values['rh_action'] = $action;
    }
    return $this
      ->drupalCreateNode($values);
  }

}

Classes

Namesort descending Description
NodeBehaviorInvocationTest Test that rabbit hole behaviors are invoked correctly for nodes.