function TestSetupTrait::__get
Implements the magic method for getting object properties.
Ensures \Drupal::getContainer() is used when getting the container property, if possible.
File
-
core/
lib/ Drupal/ Core/ Test/ TestSetupTrait.php, line 206
Class
- TestSetupTrait
- Provides a trait for shared test setup functionality.
Namespace
Drupal\Core\TestCode
public function __get($name) : mixed {
if ($name === 'container') {
return \Drupal::hasContainer() ? \Drupal::getContainer() : $this->privateContainer;
}
trigger_error('Undefined property ' . __CLASS__ . "::\${$name}", E_USER_WARNING);
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.