You are here

trait FeedsExCommonTrait in Feeds extensible parsers 8

Provides methods useful for Kernel and Functional tests.

This trait is meant to be used only by test classes.

Hierarchy

2 files declare their use of FeedsExCommonTrait
FeedsExBrowserTestBase.php in tests/src/Functional/FeedsExBrowserTestBase.php
ParserTestBase.php in tests/src/FunctionalJavascript/Feeds/Parser/ParserTestBase.php

File

tests/src/Traits/FeedsExCommonTrait.php, line 10

Namespace

Drupal\Tests\feeds_ex\Traits
View source
trait FeedsExCommonTrait {

  /**
   * Returns the absolute path to the Drupal root.
   *
   * @return string
   *   The absolute path to the directory where Drupal is installed.
   */
  protected function absolute() {
    return realpath(getcwd());
  }

  /**
   * Returns the absolute directory path of the Feed Extensible parsers module.
   *
   * @return string
   *   The absolute path to the Feeds module.
   */
  protected function absolutePath() {
    return $this
      ->absolute() . '/' . drupal_get_path('module', 'feeds_ex');
  }

  /**
   * Returns the url to the Feeds Extensible parsers resources directory.
   *
   * @return string
   *   The url to the Feeds resources directory.
   */
  protected function resourcesUrl() {
    return \Drupal::request()
      ->getSchemeAndHttpHost() . '/' . drupal_get_path('module', 'feeds_ex') . '/tests/resources';
  }

  /**
   * Returns the absolute directory path of the resources folder.
   *
   * @return string
   *   The absolute path to the resources folder.
   */
  protected function resourcesPath() {
    return $this
      ->absolutePath() . '/tests/resources';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FeedsExCommonTrait::absolute protected function Returns the absolute path to the Drupal root.
FeedsExCommonTrait::absolutePath protected function Returns the absolute directory path of the Feed Extensible parsers module.
FeedsExCommonTrait::resourcesPath protected function Returns the absolute directory path of the resources folder.
FeedsExCommonTrait::resourcesUrl protected function Returns the url to the Feeds Extensible parsers resources directory.