You are here

public function DrupalTest::testAddCommands in Forena Reports 8

Verify that we can add commands to the render array

File

tests/src/Unit/Document/DrupalTest.php, line 45

Class

DrupalTest
Test Drupal Document Features @group Forena @require module forena @coversDefaultClass \Drupal\forena\FrxPlugin\Document\Drupal

Namespace

Drupal\Tests\forena\Unit\Document

Code

public function testAddCommands() {
  $doc = DocManager::instance()
    ->getDocument();
  $command = [
    'command' => 'invoke',
    'method' => 'attr',
    'selector' => 'input#my-id',
    'arguments' => [
      'checked',
      '1',
    ],
  ];
  $doc
    ->addAjaxCommand($command, 'post');
  $commands = $doc
    ->getAjaxCommands();
  $this
    ->assertEquals(1, count($commands['post']));
  $this
    ->assertInstanceOf('Drupal\\Core\\Ajax\\InvokeCommand', $commands['post'][0]);
}