ActionLinkFlashCommandTest.php in Flag 8.4
File
tests/src/Unit/Ajax/ActionLinkFlashCommandTest.php
View source
<?php
namespace Drupal\Tests\flag\Unit\Ajax;
use Drupal\flag\Ajax\ActionLinkFlashCommand;
use Drupal\Tests\UnitTestCase;
class ActionLinkFlashCommandTest extends UnitTestCase {
protected $random;
protected function setUp() {
parent::setUp();
$this->random = $this
->getRandomGenerator();
}
public function testRender() {
$selector = '.' . $this->random
->name(10, TRUE);
$message = $this->random
->string(100, TRUE);
$command = new ActionLinkFlashCommand($selector, $message);
$expected = [
'command' => 'actionLinkFlash',
'selector' => $selector,
'message' => $message,
];
$this
->assertEquals($expected, $command
->render(), 'The command was created as expected ');
}
}