function AjaxResponseTest::createCommandMock
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php \Drupal\Tests\Core\Ajax\AjaxResponseTest::createCommandMock()
Creates a mock of the Drupal\Core\Ajax\CommandInterface.
Parameters
string $command_name: The command name to pass to the mock.
File
-
core/
tests/ Drupal/ Tests/ Core/ Ajax/ AjaxResponseTest.php, line 189
Class
Namespace
Drupal\Tests\Core\AjaxCode
private function createCommandMock(string $command_name) : CommandInterface {
$command = $this->createMock('Drupal\\Core\\Ajax\\CommandInterface');
$command->expects($this->once())
->method('render')
->willReturn([
'command' => $command_name,
]);
return $command;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.