Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
setup-integration
framework
Magento
TestFramework
Annotation
DataProviderFromFile.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\TestFramework\Annotation
;
8
9
use
Magento\TestFramework\Deploy\CliCommand
;
10
use
Magento\TestFramework\Deploy\TestModuleManager
;
11
use
Magento\TestFramework\TestCase\MutableDataInterface
;
12
16
class
DataProviderFromFile
17
{
21
private
$moduleManager;
22
26
private
$cliCommand;
27
31
public
function
__construct
()
32
{
33
$this->moduleManager =
new
TestModuleManager
();
34
$this->cliCommand =
new
CliCommand
($this->moduleManager);
35
}
36
43
public
function
startTest
(\PHPUnit\Framework\TestCase $test)
44
{
45
$annotations = $test->getAnnotations();
46
//This annotation can be declared only on method level
47
if
(isset($annotations[
'method'
][
'dataProviderFromFile'
]) && $test instanceof
MutableDataInterface
) {
48
$data
= include TESTS_MODULES_PATH .
"/"
. $annotations[
'method'
][
'dataProviderFromFile'
][0];
49
$test->setData(
$data
);
50
}
else
if
(!$test instanceof
MutableDataInterface
) {
51
throw
new \Exception(
"Test type do not supports @dataProviderFromFile annotation"
);
52
}
53
}
54
61
public
function
endTest
(\PHPUnit\Framework\TestCase $test)
62
{
63
if
($test instanceof
MutableDataInterface
) {
64
$test->flushData();
65
}
66
}
67
}
Magento\TestFramework\Annotation
Definition:
ApiDataFixture.php:13
Magento\TestFramework\TestCase\MutableDataInterface
Definition:
MutableDataInterface.php:12
Magento\TestFramework\Annotation\DataProviderFromFile\__construct
__construct()
Definition:
DataProviderFromFile.php:31
Magento\TestFramework\Annotation\DataProviderFromFile
Definition:
DataProviderFromFile.php:16
Magento\TestFramework\Deploy\CliCommand
Definition:
CliCommand.php:16
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\TestFramework\Annotation\DataProviderFromFile\startTest
startTest(\PHPUnit\Framework\TestCase $test)
Definition:
DataProviderFromFile.php:43
Magento\TestFramework\Annotation\DataProviderFromFile\endTest
endTest(\PHPUnit\Framework\TestCase $test)
Definition:
DataProviderFromFile.php:61
Magento\TestFramework\Deploy\TestModuleManager
Definition:
TestModuleManager.php:15