function backendCase::testRealtimeOutput

8.0.x backendTest.php backendCase::testRealtimeOutput()
6.x backendTest.php backendCase::testRealtimeOutput()
7.x backendTest.php backendCase::testRealtimeOutput()
5.x backendTest.php backendCase::testRealtimeOutput()
master backendTest.php backendCase::testRealtimeOutput()

Covers the following target responsibilities.

  • Insures that the 'Drush version' line from drush status appears in the output.
  • Insures that the backend output start marker appears in the output (this is a backend command).
  • Insures that the drush output appears before the backend output start marker (output is displayed in 'real time' as it is produced).

File

tests/backendTest.php, line 103
We choose to test the backend system in two parts. - Origin. These tests assure that we are generate a proper ssh command when a backend invoke is needed. - Target. These tests assure that drush generates a delimited JSON array …

Class

backendCase

Code

function testRealtimeOutput() {
  $exec = sprintf('%s core-status --backend --nocolor 2>&1', UNISH_DRUSH);
  $this->execute($exec);

  $output = $this->getOutput();
  $drush_version_offset = strpos($output, "Drush version");
  $backend_output_offset = strpos($output, "DRUSH_BACKEND_OUTPUT_START>>>");

  $this->assertTrue($drush_version_offset !== FALSE, "'Drush version' string appears in output.");
  $this->assertTrue($backend_output_offset !== FALSE, "Drush backend output marker appears in output.");
  $this->assertTrue($drush_version_offset < $backend_output_offset, "Drush version string appears in output before the backend output marker.");
}