Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit b2146db

Browse files
committed
Refactor test after modifying factory
1 parent d78ae56 commit b2146db

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

setup/src/Magento/Setup/Test/Unit/Module/ConfigGeneratorTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
namespace Magento\Setup\Test\Unit\Module;
77

88
use Magento\Framework\App\DeploymentConfig;
9+
use Magento\Framework\Config\Data\ConfigData;
10+
use Magento\Framework\Config\Data\ConfigDataFactory;
911
use Magento\Framework\Config\File\ConfigFilePool;
1012
use Magento\Framework\Math\Random;
13+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1114
use Magento\Setup\Model\ConfigGenerator;
1215
use Magento\Framework\Config\ConfigOptionsListConstants;
1316
use Magento\Setup\Model\CryptKeyGenerator;
17+
use PHPUnit\Framework\TestCase;
1418

15-
class ConfigGeneratorTest extends \PHPUnit\Framework\TestCase
19+
class ConfigGeneratorTest extends TestCase
1620
{
1721
/**
1822
* @var ConfigGenerator
@@ -31,7 +35,16 @@ protected function setUp()
3135

3236
$cryptKeyGenerator = new CryptKeyGenerator($randomMock);
3337

34-
$this->configGeneratorObject = new ConfigGenerator($randomMock, $deployConfig, null, $cryptKeyGenerator);
38+
$objectManagerMock = $this->getMockBuilder(\Magento\Framework\App\ObjectManager::class)
39+
->disableOriginalConstructor()
40+
->getMock();
41+
42+
$objectManagerMock->method('create')->willReturn(new ConfigData('app_env'));
43+
44+
$configDataFactoryMock = (new ObjectManager($this))
45+
->getObject(ConfigDataFactory::class, ['objectManager' => $objectManagerMock]);
46+
47+
$this->configGeneratorObject = new ConfigGenerator($randomMock, $deployConfig, $configDataFactoryMock, $cryptKeyGenerator);
3548
}
3649

3750
public function testCreateCryptConfigWithInput()

0 commit comments

Comments
 (0)