You are here

public function DrushCommandsTest::testDrushCommand in Views Bulk Operations (VBO) 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/DrushCommandsTest.php \Drupal\Tests\views_bulk_operations\Functional\DrushCommandsTest::testDrushCommand()

Tests the VBO Drush command.

File

tests/src/Functional/DrushCommandsTest.php, line 63

Class

DrushCommandsTest
@coversDefaultClass \Drupal\views_bulk_operations\Commands\ViewsBulkOperationsCommands @group views_bulk_operations

Namespace

Drupal\Tests\views_bulk_operations\Functional

Code

public function testDrushCommand() {

  // Basic test.
  $this
    ->drush('vbo-exec', [
    'views_bulk_operations_test',
    'views_bulk_operations_simple_test_action',
  ]);
  for ($i = 0; $i < self::TEST_NODE_COUNT; $i++) {
    $this
      ->assertStringContainsString("Test action (preconfig: , label: Title {$i})", $this
      ->getErrorOutput());
  }

  // Exposed filters test.
  $this
    ->drush('vbo-exec', [
    'views_bulk_operations_test',
    'views_bulk_operations_simple_test_action',
  ], [
    'exposed' => 'sticky=1',
  ]);
  for ($i = 0; $i < self::TEST_NODE_COUNT; $i++) {
    $test_string = "Test action (preconfig: , label: Title {$i})";
    if ($i % 2) {
      $this
        ->assertStringContainsString($test_string, $this
        ->getErrorOutput());
    }
    else {
      $this
        ->assertStringNotContainsString($test_string, $this
        ->getErrorOutput());
    }
  }
}