trait TestTrait

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Traits/TestTrait.php \Drupal\Tests\system\Traits\TestTrait
  2. 8.9.x core/modules/system/tests/src/Traits/TestTrait.php \Drupal\Tests\system\Traits\TestTrait
  3. 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 15

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

Title Sort descending Modifiers Object type Summary
TestTrait::$stuff protected property Random string for a not very interesting trait.
TestTrait::getStuff protected function Return a test string to a trait user.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.