You are here

trait TestTrait in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Traits/TestTrait.php \Drupal\Tests\system\Traits\TestTrait
  2. 10 core/modules/system/tests/src/Traits/TestTrait.php \Drupal\Tests\system\Traits\TestTrait

A nothing trait, but declared in the Drupal\Tests namespace.

We use this trait to test autoloading of traits outside of the normal test suite namespaces.

Hierarchy

See also

\Drupal\Tests\system\Unit\TraitAccessTest

1 file declares its use of TestTrait
TraitAccessTest.php in core/modules/system/tests/src/Unit/TraitAccessTest.php

File

core/modules/system/tests/src/Traits/TestTrait.php, line 13

Namespace

Drupal\Tests\system\Traits
View source
trait TestTrait {

  /**
   * Random string for a not very interesting trait.
   *
   * @var string
   */
  protected $stuff = 'stuff';

  /**
   * Return a test string to a trait user.
   *
   * @return string
   *   Just a random sort of string.
   */
  protected function getStuff() {
    return $this->stuff;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TestTrait::$stuff protected property Random string for a not very interesting trait.
TestTrait::getStuff protected function Return a test string to a trait user.