Skip to content

Commit cebe96f

Browse files
author
Roman Ganin
committed
MAGETWO-33403: Fix integration test for performance toolkit
1 parent f05fc0c commit cebe96f

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

dev/tests/integration/testsuite/Magento/ToolkitFramework/ApplicationTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,24 @@ public static function setUpBeforeClass()
3636
public function testTest()
3737
{
3838
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
39-
$objectManager->get('Magento\Framework\App\State')
40-
->setAreaCode(\Magento\ToolkitFramework\Application::AREA_CODE);
39+
/** @var \Magento\Framework\App\State $appState */
40+
$appState = $objectManager->get('Magento\Framework\App\State');
41+
$appState->setAreaCode(\Magento\ToolkitFramework\Application::AREA_CODE);
4142

4243
$config = \Magento\ToolkitFramework\Config::getInstance();
4344
$config->loadConfig(self::$_generatorWorkingDir . '/profiles/ce/small.xml');
4445
/** @var \Magento\TestFramework\Application $itfApplication */
4546
$itfApplication = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap()->getApplication();
46-
$installDir = $itfApplication->getTempDir();
47-
$magentoBaseDir = realpath("{$installDir}/../../../../../");
4847
$shell = $this->getMock('Magento\Framework\Shell', [], [], '', false);
4948

49+
$application = new \Magento\ToolkitFramework\Application(
50+
$itfApplication->getTempDir(),
51+
$shell,
52+
$itfApplication->getInitParams()
53+
);
5054

51-
$application = new \Magento\ToolkitFramework\Application($magentoBaseDir, $shell);
5255
$application->bootstrap();
5356
foreach ($application->loadFixtures()->getFixtures() as $fixture) {
54-
echo $fixture->getActionTitle() . '... ' . PHP_EOL;
5557
$fixture->execute();
5658
}
5759
}

dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,20 @@ class Application
6464
*/
6565
protected $_applicationBaseDir;
6666

67+
/**
68+
* @var array
69+
*/
70+
protected $_initArguments;
71+
6772
/**
6873
* @param string $applicationBaseDir
6974
* @param \Magento\Framework\Shell $shell
7075
*/
71-
public function __construct($applicationBaseDir, \Magento\Framework\Shell $shell)
76+
public function __construct($applicationBaseDir, \Magento\Framework\Shell $shell, array $initArguments)
7277
{
7378
$this->_applicationBaseDir = $applicationBaseDir;
7479
$this->_shell = $shell;
80+
$this->_initArguments = $initArguments;
7581
}
7682

7783
/**
@@ -217,8 +223,11 @@ public function applyFixture($fixtureFilename)
217223
public function getObjectManager()
218224
{
219225
if (!$this->_objectManager) {
220-
$objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER);
221-
$this->_objectManager = $objectManagerFactory->create($_SERVER);
226+
$objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(
227+
BP,
228+
$this->_initArguments
229+
);
230+
$this->_objectManager = $objectManagerFactory->create($this->_initArguments);
222231
$this->_objectManager->get('Magento\Framework\App\State')->setAreaCode(self::AREA_CODE);
223232
}
224233
return $this->_objectManager;

0 commit comments

Comments
 (0)