protected function DrupalTest::setMockContainerService in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/DrupalTest.php \Drupal\Tests\Core\DrupalTest::setMockContainerService()
Sets up a mock expectation for the container get() method.
Parameters
string $service_name: The service name to expect for the get() method.
mixed $return: The value to return from the mocked container get() method.
32 calls to DrupalTest::setMockContainerService()
- DrupalTest::testAccessManager in core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php - Tests the accessManager() method.
- DrupalTest::testCache in core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php - Tests the service() method.
- DrupalTest::testConfig in core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php - Tests the config() method.
- DrupalTest::testCsrfToken in core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php - Tests the csrfToken() method.
- DrupalTest::testCurrentUser in core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php - Tests the currentUser() method.
File
- core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php, line 455 - Contains \Drupal\Tests\Core\DrupalTest.
Class
- DrupalTest
- Tests the Drupal class.
Namespace
Drupal\Tests\CoreCode
protected function setMockContainerService($service_name, $return = NULL) {
$expects = $this->container
->expects($this
->once())
->method('get')
->with($service_name);
if (isset($return)) {
$expects
->will($this
->returnValue($return));
}
else {
$expects
->will($this
->returnValue(TRUE));
}
\Drupal::setContainer($this->container);
}