forked from drush-ops/drush
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WatchdogTailTest.php
38 lines (36 loc) · 1.16 KB
/
WatchdogTailTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace Unish;
/**
* Tests for watchdog tail command.
*
* @group commands
* @group watchdog
* @group slow
*/
class WatchdogTailTest extends CommandUnishTestCase
{
/**
* Test that watchdog tail works.
*/
public function testWatchdogTail()
{
$this->setUpDrupal(1, true);
$ret = $this->drush('pm-install', ['dblog']);
$this->assertEquals($ret, 0);
$options = [];
$childDrushProcess = $this->drushBackground('watchdog-tail', [], $options + ['simulate' => null]);
$iteration = 0;
$expected_output = [];
do {
$iteration++;
$expected_output[$iteration] = "watchdog tail iteration $iteration.";
$this->drush('php-eval', ["Drupal::logger('drush')->notice('{$expected_output[$iteration]}');"]);
sleep(2);
$output = $childDrushProcess->getIncrementalOutput();
$this->assertStringContainsString($expected_output[$iteration], $output);
if ($iteration > 1) {
$this->assertStringNotContainsString($expected_output[$iteration - 1], $output);
}
} while ($iteration < 3);
}
}