10 use Symfony\Component\Console\Tester\CommandTester;
27 private $deploymentConfig;
32 private $installerFactory;
42 private $objectManager;
47 private $localeValidatorMock;
52 private $timezoneValidatorMock;
57 private $currencyValidatorMock;
62 private $urlValidatorMock;
71 $this->urlValidatorMock = $this->createMock(UrlValidator::class);
72 $this->localeValidatorMock = $this->createMock(LocaleValidator::class);
73 $this->timezoneValidatorMock = $this->createMock(TimezoneValidator::class);
74 $this->currencyValidatorMock = $this->createMock(CurrencyValidator::class);
76 $this->installerFactory = $this->createMock(\
Magento\Setup\Model\InstallerFactory::class);
77 $this->deploymentConfig = $this->createMock(\
Magento\Framework\
App\DeploymentConfig::class);
78 $this->installer = $this->createMock(\
Magento\Setup\Model\Installer::class);
79 $objectManagerProvider = $this->createMock(\
Magento\Setup\Model\ObjectManagerProvider::class);
80 $this->objectManager = $this->getMockForAbstractClass(
81 \
Magento\Framework\ObjectManagerInterface::class,
86 $objectManagerProvider->expects($this->once())->method(
'get')->willReturn($this->objectManager);
88 $this->installerFactory,
89 $this->deploymentConfig,
90 $objectManagerProvider,
91 $this->localeValidatorMock,
92 $this->timezoneValidatorMock,
93 $this->currencyValidatorMock,
94 $this->urlValidatorMock
100 $this->deploymentConfig->expects($this->once())
101 ->method(
'isAvailable')
102 ->will($this->returnValue(
true));
103 $this->installer->expects($this->once())
104 ->method(
'installUserConfig');
105 $this->installerFactory->expects($this->once())
107 ->will($this->returnValue($this->installer));
108 $tester =
new CommandTester($this->command);
109 $tester->execute([]);
114 $this->deploymentConfig->expects($this->once())
115 ->method(
'isAvailable')
116 ->will($this->returnValue(
false));
117 $this->installerFactory->expects($this->never())
119 $tester =
new CommandTester($this->command);
120 $tester->execute([]);
121 $this->assertStringMatchesFormat(
122 "Store settings can't be saved because the Magento application is not installed.%w",
123 $tester->getDisplay()
134 $this->localeValidatorMock->expects($this->any())->method(
'isValid')->willReturn(
false);
135 $this->timezoneValidatorMock->expects($this->any())->method(
'isValid')->willReturn(
false);
136 $this->currencyValidatorMock->expects($this->any())->method(
'isValid')->willReturn(
false);
137 $this->urlValidatorMock->expects($this->any())->method(
'isValid')->willReturn(
false);
139 $this->deploymentConfig->expects($this->once())
140 ->method(
'isAvailable')
141 ->will($this->returnValue(
true));
142 $this->installerFactory->expects($this->never())
144 $commandTester =
new CommandTester($this->command);
145 $commandTester->execute(
$option);
146 $this->assertContains($error, $commandTester->getDisplay());
162 .
'\': Invalid URL \
'http://example.com_test\'.' 167 .
'\': Invalid
value. To see possible values, run command \
'bin/magento info:language:list\'.' 172 .
'\': Invalid
value. To see possible values, run command \
'bin/magento info:timezone:list\'.' 177 .
'\': Invalid
value. To see possible values, run command \
'bin/magento info:currency:list\'.' 182 .
'\': Invalid
value. Possible values (0|1).
' 185 ['--
' . StoreConfigurationDataMapper::KEY_IS_SECURE => 'invalidValue
'], 187 .
'\': Invalid
value. Possible values (0|1).
' 190 ['--
' . StoreConfigurationDataMapper::KEY_BASE_URL_SECURE => 'http:
192 .
'\': Invalid URL \
'http://www.sample.com\'.' 197 .
'\': Invalid
value. Possible values (0|1).
' 200 ['--
' . StoreConfigurationDataMapper::KEY_ADMIN_USE_SECURITY_KEY => 'invalidValue
'], 202 .
'\': Invalid
value. Possible values (0|1).
'
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
const KEY_ADMIN_USE_SECURITY_KEY
const KEY_IS_SECURE_ADMIN
const KEY_BASE_URL_SECURE
testExecuteNotInstalled()
testExecuteInvalidData(array $option, $error)