Files
piratepoet/tests/_support/CheckSkippedTestsExtension.php
Amine Ben hammou 43df66d162 Add public keyword to methods
[MAILPOET-2413]
2019-12-26 18:09:45 +03:00

20 lines
611 B
PHP

<?php
use Codeception\Event\SuiteEvent;
use Codeception\Events;
use Codeception\Extension;
class CheckSkippedTestsExtension extends Extension { // phpcs:ignore PSR1.Classes.ClassDeclaration
static $events = [
Events::SUITE_AFTER => 'checkErrorsAfterTests',
];
public function checkErrorsAfterTests(SuiteEvent $e) {
$branch = getenv('CIRCLE_BRANCH');
$skipped = $e->getResult()->skipped();
if (in_array($branch, ['master', 'release']) && (count($skipped) !== 0)) {
throw new PHPUnit_Framework_ExpectationFailedException("Failed, Cannot skip tests on branch $branch.");
}
}
}