'checkSkippedTests', ]; public function checkSkippedTests(FailEvent $event) { $branch = getenv('CIRCLE_BRANCH'); $testName = $event->getTest()->getName(); // list of tests that are allowed to be skipped on trunk and release branches $allowedToSkipList = [ 'createSubscriptionSegmentForActiveSubscriptions', 'testAllSubscribersFoundWithOperatorAny', 'testAllSubscribersFoundWithOperatorNoneOf', 'testAllSubscribersFoundWithOperatorAllOf', 'automationTriggeredByRegistrationWitConfirmationNeeded', 'automationTriggeredByRegistrationWithoutConfirmationNeeded', // The next two tests can be removed after dropping support for WP 6.4 'createAndSendStandardNewsletter', 'displayNewsletterPreview', ]; if (in_array($branch, ['trunk', 'release']) && !in_array($testName, $allowedToSkipList)) { throw new \PHPUnit\Framework\ExpectationFailedException("Failed, cannot skip tests on branch $branch."); } } }