diff --git a/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php b/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php index 1872406..1dd66b8 100644 --- a/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php +++ b/core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php @@ -294,27 +294,16 @@ public function testSettingsCommand() { * @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, @@ -323,47 +312,10 @@ public function testOpenDialogCommand() { ], ]; $this->assertEquals($expected, $command->render()); - } - - /** - * Tests that OpenDialogCommand objects title can be changed. - */ - public function testOpenDialogCommandSetTitle() { - $command = $this - ->getMockBuilder(OpenDialogCommand::class) - ->setConstructorArgs([ - '#some-dialog', - 'Dialog title', - '

Text!

', - [ - 'url' => FALSE, - 'width' => 500, - ], - ]) - ->setMethods(['getRenderedContent']) - ->getMock(); - - $command - ->expects(static::once()) - ->method('getRenderedContent') - ->willReturn('

Text!

'); - - $expected = [ - 'command' => 'openDialog', - 'selector' => '#some-dialog', - 'settings' => NULL, - 'data' => '

Text!

', - 'dialogOptions' => [ - 'url' => FALSE, - 'width' => 500, - 'title' => 'New title', - 'modal' => FALSE, - ], - ]; $command->setDialogTitle('New title'); - - $this->assertEquals($command->render(), $expected, "OpenDialogCommand::render() didn't return the expected array."); + $expected['dialogOptions']['title'] = 'New title'; + $this->assertEquals($expected, $command->render()); } /**