rabbit_hole-8.x-1.x-dev/modules/rh_user/tests/src/Functional/UserBehaviorInvocationTest.php

modules/rh_user/tests/src/Functional/UserBehaviorInvocationTest.php
<?php

namespace Drupal\Tests\rh_taxonomy\Functional;

use Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorInvocationTestBase;

/**
 * Test that rabbit hole behaviors are invoked correctly for user entities.
 *
 * @group rh_user
 */
class UserBehaviorInvocationTest extends RabbitHoleBehaviorInvocationTestBase {

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

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['rh_user', 'user'];

  /**
   * {@inheritdoc}
   */
  protected function createEntityBundle($action = NULL) {
    // We can't create a new bundle, but we can save Rabbit Hole settings.
    if (isset($action)) {
      $this->behaviorSettingsManager->saveBehaviorSettings([
        'action' => $action,
        'allow_override' => TRUE,
      ], 'user', NULL);
    }
    return NULL;
  }

  /**
   * {@inheritdoc}
   */
  protected function createEntity($action = NULL) {
    $values = [];
    if (isset($action)) {
      $values['rh_action'] = $action;
    }
    return $this->drupalCreateUser([], $this->randomMachineName(), FALSE, $values);
  }

  /**
   * {@inheritdoc}
   */
  protected function getViewPermissions() {
    return ['access user profiles'];
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc