- $command = $this->getMockBuilder('Drupal\Core\Ajax\OpenDialogCommand')
- ->setConstructorArgs([
- '#some-dialog', 'Title', '<p>Text!</p>', [
- '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', '<p>Text!</p>', [
+ 'url' => FALSE,
+ 'width' => 500,
+ ]);