21 private $deploymentConfig;
36 private $phpReadinessCheck;
41 private $readinessCheck;
46 private $basePackageInfo;
61 $this->deploymentConfig = $this->createMock(\
Magento\Framework\
App\DeploymentConfig::class);
62 $this->deploymentConfig->expects($this->once())
72 $this->filesystem = $this->createMock(\
Magento\Framework\Filesystem::class);
73 $this->write = $this->createMock(\
Magento\Framework\
Filesystem\Directory\Write::class);
74 $this->filesystem->expects($this->once())->method(
'getDirectoryWrite')->willReturn($this->write);
75 $this->phpReadinessCheck = $this->createMock(\
Magento\
Setup\Model\PhpReadinessCheck::class);
76 $this->basePackageInfo = $this->createMock(\
Magento\
Setup\Model\BasePackageInfo::class);
77 $this->basePackageInfo->expects($this->once())->method(
'getPaths')->willReturn([
__FILE__]);
81 $this->deploymentConfig,
83 $this->phpReadinessCheck,
84 $this->basePackageInfo,
87 $this->phpReadinessCheck
88 ->expects($this->once())
89 ->method(
'checkPhpVersion')
90 ->willReturn([
'responseType' =>
'success']);
91 $this->phpReadinessCheck
92 ->expects($this->once())
93 ->method(
'checkPhpExtensions')
94 ->willReturn([
'responseType' =>
'success']);
95 $this->phpReadinessCheck
96 ->expects($this->once())
97 ->method(
'checkPhpCronSettings')
98 ->willReturn([
'responseType' =>
'success']);
108 $this->dbValidator->expects($this->once())
109 ->method(
'checkDatabaseConnection')
111 $this->write->expects($this->once())->method(
'isExist')->willReturn(
false);
112 $this->write->expects($this->never())->method(
'readFile');
116 'error' =>
'Connection failure' 125 $expectedJson = json_encode($expected, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
126 $this->write->expects($this->once())
127 ->method(
'writeFile')
129 $this->readinessCheck->runReadinessCheck();
134 $this->dbValidator->expects($this->once())
135 ->method(
'checkDatabaseConnection')
136 ->willThrowException(
new \
Magento\
Setup\
Exception(
'Database user username does not have write access.'));
137 $this->write->expects($this->once())->method(
'isExist')->willReturn(
false);
138 $this->write->expects($this->never())->method(
'readFile');
142 'error' =>
'Database user username does not have write access.' 151 $expectedJson = json_encode($expected, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
152 $this->write->expects($this->once())
153 ->method(
'writeFile')
155 $this->readinessCheck->runReadinessCheck();
160 $this->dbValidator->expects($this->once())->method(
'checkDatabaseConnection')->willReturn(
true);
161 $this->write->expects($this->once())->method(
'isExist')->willReturn(
false);
162 $this->write->expects($this->never())->method(
'readFile');
172 $expectedJson = json_encode($expected, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
173 $this->write->expects($this->once())
174 ->method(
'writeFile')
176 $this->readinessCheck->runReadinessCheck();
181 $this->dbValidator->expects($this->once())->method(
'checkDatabaseConnection')->willReturn(
true);
182 $this->write->expects($this->once())->method(
'isExist')->willReturn(
true);
183 $this->write->expects($this->once())->method(
'readFile')->willReturn(
'{"current_timestamp": 50}');
194 $expectedJson = json_encode($expected, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
195 $this->write->expects($this->once())
196 ->method(
'writeFile')
198 $this->readinessCheck->runReadinessCheck();
const SETUP_CRON_JOB_STATUS_FILE
const KEY_CURRENT_TIMESTAMP
testRunReadinessCheckNoDbWriteAccess()
defined('MTF_BOOT_FILE')||define('MTF_BOOT_FILE' __FILE__
const KEY_PHP_EXTENSIONS_VERIFIED
const KEY_PHP_VERSION_VERIFIED
const KEY_PHP_SETTINGS_VERIFIED
testRunReadinessCheckNoDbAccess()
testRunReadinessCheckLastTimestamp()
const KEY_READINESS_CHECKS
const KEY_DB_WRITE_PERMISSION_VERIFIED