/
ErrorExpectationsCest.php
executable file
·49 lines (38 loc) · 1.27 KB
/
ErrorExpectationsCest.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
39
40
41
42
43
44
45
46
47
48
49
<?php
class ErrorExpectationsCest
{
public function _before(\CliGuy $I)
{
$I->amInPath('tests/data/error_handling');
}
public function expectNoticeWorks(\CliGuy $I)
{
$this->skipIfOldPhpUnit($I);
$I->executeCommand('run tests/unit/ErrorExceptionTest.php:testNotice');
$I->seeInShellOutput("OK (");
}
public function expectWarningWorks(\CliGuy $I)
{
$this->skipIfOldPhpUnit($I);
$I->executeCommand('run tests/unit/ErrorExceptionTest.php:testWarning');
$I->seeInShellOutput('OK (');
}
public function expectErrorWorks(\CliGuy $I)
{
$this->skipIfOldPhpUnit($I);
$I->executeCommand('run tests/unit/ErrorExceptionTest.php:testError');
$I->seeInShellOutput('OK (');
}
public function expectDeprecationWorks(\CliGuy $I)
{
$this->skipIfOldPhpUnit($I);
$I->executeCommand('run tests/unit/ErrorExceptionTest.php:testDeprecation');
$I->seeInShellOutput('OK (');
}
private function skipIfOldPhpUnit(CliGuy $I)
{
if (version_compare(\PHPUnit\Runner\Version::id(), '8.4.0', '<')) {
$I->markTestSkipped('expectXXX is only available on PHPUnit 8.4+');
}
}
}