Skip to content

Commit eab6d10

Browse files
committed
ACP2E-782: Create PHP Attribute that must be used instead of magentoDataFixture for executing parameterized fixtures in the test
1 parent f512bff commit eab6d10

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

dev/tests/api-functional/framework/Magento/TestFramework/Annotation/ApiDataFixture.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,12 @@ protected function getAnnotation(): string
5757
{
5858
return self::ANNOTATION;
5959
}
60+
61+
/**
62+
* @inheritdoc
63+
*/
64+
protected function getDbIsolationState(TestCase $test)
65+
{
66+
return parent::getDbIsolationState($test) ?: ['disabled'];
67+
}
6068
}

dev/tests/api-functional/framework/Magento/TestFramework/Bootstrap/WebapiDocBlock.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,19 @@ protected function _getSubscribers(\Magento\TestFramework\Application $applicati
2828
{
2929
$subscribers = parent::_getSubscribers($application);
3030
foreach ($subscribers as $key => $subscriber) {
31-
if (in_array(get_class($subscriber), [ConfigFixture::class, Transaction::class])) {
31+
if (get_class($subscriber) == ConfigFixture::class) {
3232
unset($subscribers[$key]);
33+
} elseif (get_class($subscriber) == Transaction::class) {
34+
$subscribers[$key] = new \Magento\TestFramework\Event\Transaction(
35+
new \Magento\TestFramework\EventManager(
36+
[
37+
new \Magento\TestFramework\Annotation\DbIsolation(),
38+
new \Magento\TestFramework\Annotation\ApiDataFixture(),
39+
]
40+
)
41+
);
3342
}
3443
}
35-
$subscribers[] = new \Magento\TestFramework\Annotation\ApiDataFixture();
3644
$subscribers[] = new ApiConfigFixture();
3745

3846
return $subscribers;

0 commit comments

Comments
 (0)