Skip to content

Commit b553757

Browse files
committed
Uses Helper class to check for appropriate test output for invalid command based on platform
1 parent a0ce115 commit b553757

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

tests/BackgroundJobTest.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ class BackgroundJobTest extends \PHPUnit_Framework_TestCase
2121
*/
2222
private $logFile;
2323

24+
/**
25+
* @var Helper
26+
*/
27+
private $helper;
28+
2429
/**
2530
* {@inheritdoc}
2631
*/
@@ -30,6 +35,8 @@ protected function setUp()
3035
if (file_exists($this->logFile)) {
3136
unlink($this->logFile);
3237
}
38+
39+
$this->helper = new Helper();
3340
}
3441

3542
/**
@@ -89,11 +96,19 @@ public function testInvalidCommand()
8996
$this->runJob(['command' => 'invalid-command']);
9097

9198
$this->assertContains('invalid-command', $this->getLogContent());
92-
$this->assertContains('not found', $this->getLogContent());
93-
$this->assertContains(
94-
"ERROR: Job exited with status '127'",
95-
$this->getLogContent()
96-
);
99+
100+
if ($this->helper->getPlatform() === Helper::UNIX) {
101+
$this->assertContains('not found', $this->getLogContent());
102+
$this->assertContains(
103+
"ERROR: Job exited with status '127'",
104+
$this->getLogContent()
105+
);
106+
} else {
107+
$this->assertContains(
108+
'not recognized as an internal or external command',
109+
$this->getLogContent()
110+
);
111+
}
97112
}
98113

99114
/**

0 commit comments

Comments
 (0)