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
<?php
namespace Codeception\Test\Feature;
use Codeception\Test\Metadata;
trait IgnoreIfMetadataBlocked
{
/**
* @return Metadata
*/
abstract protected function getMetadata();
abstract protected function ignore($ignored);
/**
* @return \PHPUnit\Framework\TestResult
*/
abstract protected function getTestResultObject();
protected function ignoreIfMetadataBlockedStart()
{
if (!$this->getMetadata()->isBlocked()) {
return;
}
$this->ignore(true);
if ($this->getMetadata()->getSkip() !== null) {
$this->getTestResultObject()->addFailure($this, new \PHPUnit\Framework\SkippedTestError((string)$this->getMetadata()->getSkip()), 0);
return;
}
if ($this->getMetadata()->getIncomplete() !== null) {
$this->getTestResultObject()->addFailure($this, new \PHPUnit\Framework\IncompleteTestError((string)$this->getMetadata()->getIncomplete()), 0);
return;
}
}
}