Use Codeception\TestInterface::getName() instead of Codeception\TestInterface::getMetadata()
This commit changes the code to use $event->getTest()->getName() instead of $event->getTest()->getMetadata()->getName() to get the name of the current test. This was necessary because the latter was returning null for integration tests while the former works both for acceptance and integration tests. I did not investigate why Codeception behaves this way due to lack of time, there is a chance that this is a bug in Codeception. Since $event->getTest() returns an instance of TestInterface and this class does not define getName() (but the call works probably due to some magic method), it was necessary to edit phpstan.neon to skip a PHPStan error. [MAILPOET-4765]
This commit is contained in:
committed by
Rostislav Wolný
parent
713b0255f7
commit
ea16472ab1
@ -74,6 +74,10 @@ parameters:
|
|||||||
message: '/^Cannot call method get\(\) on mixed.$/'
|
message: '/^Cannot call method get\(\) on mixed.$/'
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../lib/PostEditorBlocks/WooCommerceBlocksIntegration.php
|
path: ../../lib/PostEditorBlocks/WooCommerceBlocksIntegration.php
|
||||||
|
-
|
||||||
|
message: '/^Call to an undefined method Codeception\\TestInterface::getName()./'
|
||||||
|
count: 1
|
||||||
|
path: ../../tests/_support/CheckSkippedTestsExtension.php
|
||||||
reportUnmatchedIgnoredErrors: true
|
reportUnmatchedIgnoredErrors: true
|
||||||
dynamicConstantNames:
|
dynamicConstantNames:
|
||||||
- MAILPOET_PREMIUM_INITIALIZED
|
- MAILPOET_PREMIUM_INITIALIZED
|
||||||
|
@ -12,7 +12,7 @@ class CheckSkippedTestsExtension extends Extension {
|
|||||||
|
|
||||||
public function checkSkippedTests(FailEvent $event) {
|
public function checkSkippedTests(FailEvent $event) {
|
||||||
$branch = getenv('CIRCLE_BRANCH');
|
$branch = getenv('CIRCLE_BRANCH');
|
||||||
$testName = $event->getTest()->getMetadata()->getName();
|
$testName = $event->getTest()->getName();
|
||||||
|
|
||||||
// list of tests that are allowed to be skipped on trunk and release branches
|
// list of tests that are allowed to be skipped on trunk and release branches
|
||||||
$allowedToSkipList = [
|
$allowedToSkipList = [
|
||||||
|
Reference in New Issue
Block a user