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 108

Namespace

Unish

Class

backendCase
We choose to test the backend system in two parts.

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.");
}