function AjaxResponseTest::createCommandMock
Creates a mock of the Drupal\Core\Ajax\CommandInterface.
Parameters
string $command_name: The command name to pass to the mock.
1 call to AjaxResponseTest::createCommandMock()
- AjaxResponseTest::testMergeWithOtherAjaxResponse in core/
tests/ Drupal/ Tests/ Core/ Ajax/ AjaxResponseTest.php - Tests the mergeWith() method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Ajax/ AjaxResponseTest.php, line 184
Class
- AjaxResponseTest
- @coversDefaultClass \Drupal\Core\Ajax\AjaxResponse[[api-linebreak]] @group Ajax
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.