Skip to content

Commit 3495640

Browse files
committed
MQE-1911: --allow-skipped removing test hooks
- Fixed conditional - Modified existing conditional to follow same pattern
1 parent 342c6f7 commit 3495640

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public function assembleTestPhp($testObject)
242242

243243
$className = $testObject->getCodeceptionName();
244244
try {
245-
if (!$testObject->isSkipped() && !MftfApplicationConfig::getConfig()->allowSkipped()) {
245+
if (!$testObject->isSkipped() || MftfApplicationConfig::getConfig()->allowSkipped()) {
246246
$hookPhp = $this->generateHooksPhp($testObject->getHooks());
247247
} else {
248248
$hookPhp = null;
@@ -1601,7 +1601,13 @@ private function generateTestPhp($test)
16011601
$testName = str_replace(' ', '', $testName);
16021602
$testAnnotations = $this->generateAnnotationsPhp($test->getAnnotations(), true);
16031603
$dependencies = 'AcceptanceTester $I';
1604-
if ($test->isSkipped() && !MftfApplicationConfig::getConfig()->allowSkipped()) {
1604+
if (!$test->isSkipped() || MftfApplicationConfig::getConfig()->allowSkipped()) {
1605+
try {
1606+
$steps = $this->generateStepsPhp($test->getOrderedActions());
1607+
} catch (\Exception $e) {
1608+
throw new TestReferenceException($e->getMessage() . " in Test \"" . $test->getName() . "\"");
1609+
}
1610+
} else {
16051611
$skipString = "This test is skipped due to the following issues:\\n";
16061612
$issues = $test->getAnnotations()['skip'] ?? null;
16071613
if (isset($issues)) {
@@ -1611,12 +1617,6 @@ private function generateTestPhp($test)
16111617
}
16121618
$steps = "\t\t" . '$scenario->skip("' . $skipString . '");' . "\n";
16131619
$dependencies .= ', \Codeception\Scenario $scenario';
1614-
} else {
1615-
try {
1616-
$steps = $this->generateStepsPhp($test->getOrderedActions());
1617-
} catch (\Exception $e) {
1618-
throw new TestReferenceException($e->getMessage() . " in Test \"" . $test->getName() . "\"");
1619-
}
16201620
}
16211621

16221622
$testPhp .= $testAnnotations;

0 commit comments

Comments
 (0)