X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FCore%2FAjax%2FAjaxCommandsTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FTests%2FCore%2FAjax%2FAjaxCommandsTest.php;h=1dd66b83283793753d56e1c28107a17aeb5413ad;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=4db1d021587e9b36b5e20a2aaad1de4d53c363e5;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php b/web/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php index 4db1d0215..1dd66b832 100644 --- a/web/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php +++ b/web/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php @@ -25,6 +25,7 @@ use Drupal\Core\Ajax\SetDialogOptionCommand; use Drupal\Core\Ajax\SetDialogTitleCommand; use Drupal\Core\Ajax\RedirectCommand; use Drupal\Core\Ajax\UpdateBuildIdCommand; +use Drupal\Core\Ajax\OpenDialogCommand; /** * Test coverage for various classes in the \Drupal\Core\Ajax namespace. @@ -293,27 +294,16 @@ class AjaxCommandsTest extends UnitTestCase { * @covers \Drupal\Core\Ajax\OpenDialogCommand */ public function testOpenDialogCommand() { - $command = $this->getMockBuilder('Drupal\Core\Ajax\OpenDialogCommand') - ->setConstructorArgs([ - '#some-dialog', 'Title', '

Text!

', [ - 'url' => FALSE, - 'width' => 500, - ], - ]) - ->setMethods(['getRenderedContent']) - ->getMock(); - - // This method calls the render service, which isn't available. We want it - // to do nothing so we mock it to return a known value. - $command->expects($this->once()) - ->method('getRenderedContent') - ->willReturn('rendered content'); + $command = new OpenDialogCommand('#some-dialog', 'Title', '

Text!

', [ + 'url' => FALSE, + 'width' => 500, + ]); $expected = [ 'command' => 'openDialog', 'selector' => '#some-dialog', 'settings' => NULL, - 'data' => 'rendered content', + 'data' => '

Text!

', 'dialogOptions' => [ 'url' => FALSE, 'width' => 500, @@ -322,6 +312,10 @@ class AjaxCommandsTest extends UnitTestCase { ], ]; $this->assertEquals($expected, $command->render()); + + $command->setDialogTitle('New title'); + $expected['dialogOptions']['title'] = 'New title'; + $this->assertEquals($expected, $command->render()); } /**