Skip to content

Commit 63bd1a9

Browse files
oshmyheliukshiftedreality
authored andcommitted
MAGECLOUD-2891: [Cloud Docker] Verify Xdebug functionality (#415)
1 parent 6a0198f commit 63bd1a9

File tree

3 files changed

+40
-18
lines changed

3 files changed

+40
-18
lines changed

dist/docker/global.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
return [
44
'PHP_MEMORY_LIMIT' => '2048M',
5-
'PHP_ENABLE_XDEBUG' => 'false',
65
'DEBUG' => 'false',
76
'ENABLE_SENDMAIL' => 'false',
87
'UPLOAD_MAX_FILESIZE' => '64M',
98
'MAGENTO_ROOT' => '/var/www/magento',
9+
'PHP_ENABLE_XDEBUG' => 'false',
10+
'PHP_IDE_CONFIG' => 'serverName=magento_cloud_docker', #name of your server in IDE
11+
'XDEBUG_CONFIG' => 'remote_host=host.docker.internal', #docker host for developer environments, can be different for your OS
1012
];

src/Command/Docker/ConfigConvert.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ public function execute(InputInterface $input, OutputInterface $output)
8787
$content = '';
8888

8989
foreach ($this->file->requireFile($sourcePath) as $variable => $value) {
90-
$content .= $variable . '=' . $value . PHP_EOL;
90+
$formattedValue = is_bool($value) ? var_export($value, true) : $value;
91+
$content .= $variable . '=' . $formattedValue . PHP_EOL;
9192
}
9293

9394
$this->file->filePutContents($envPath, $content);

src/Test/Unit/Command/Docker/ConfigConvertTest.php

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,32 @@ public function testExecute()
8282
],
8383
],
8484
[
85-
8685
'magento_root/docker/global.php',
8786
[
8887
'MAGENTO_RUN_MODE' => 'production',
88+
'DEBUG' => false,
89+
'ENABLE_SENDMAIL' => true,
90+
'PHP_ENABLE_XDEBUG' => true,
8991
],
9092
],
9193
]);
9294
$this->fileMock->expects($this->exactly(2))
9395
->method('filePutContents')
94-
->willReturnMap([
96+
->withConsecutive(
9597
[
9698
'magento_root/docker/config.env',
97-
$this->contains('MAGENTO_CLOUD_VARIABLES=eyJBRE1JTl9FTUFJT'),
99+
$this->stringStartsWith('MAGENTO_CLOUD_VARIABLES=eyJBRE1JTl9FTUFJTCI6InRlc3Qy'),
98100
],
99101
[
100102
'magento_root/docker/global.env',
101-
'MAGENTO_RUN_MODE=InByb2R1Y3Rpb24i',
102-
],
103-
]);
103+
implode(PHP_EOL, [
104+
'MAGENTO_RUN_MODE=production',
105+
'DEBUG=false',
106+
'ENABLE_SENDMAIL=true',
107+
'PHP_ENABLE_XDEBUG=true',
108+
]) . PHP_EOL,
109+
]
110+
);
104111

105112
$this->command->execute($inputMock, $outputMock);
106113
}
@@ -144,21 +151,27 @@ public function testExecuteUsingDist()
144151
'magento_root/docker/global.php.dist',
145152
[
146153
'MAGENTO_RUN_MODE' => 'production',
154+
'DEBUG' => false,
155+
'PHP_ENABLE_XDEBUG' => true,
147156
],
148157
],
149158
]);
150159
$this->fileMock->expects($this->exactly(2))
151160
->method('filePutContents')
152-
->willReturnMap([
161+
->withConsecutive(
153162
[
154163
'magento_root/docker/config.env',
155-
$this->contains('MAGENTO_CLOUD_VARIABLES=eyJBRE1JTl9FTUFJT'),
164+
$this->stringStartsWith('MAGENTO_CLOUD_VARIABLES=eyJBRE1JTl9FTUFJT'),
156165
],
157166
[
158167
'magento_root/docker/global.env',
159-
'MAGENTO_RUN_MODE=InByb2R1Y3Rpb24i',
160-
],
161-
]);
168+
implode(PHP_EOL, [
169+
'MAGENTO_RUN_MODE=production',
170+
'DEBUG=false',
171+
'PHP_ENABLE_XDEBUG=true',
172+
]) . PHP_EOL,
173+
]
174+
);
162175

163176
$this->command->execute($inputMock, $outputMock);
164177
}
@@ -202,21 +215,27 @@ public function testExecuteUsingDistWithClean()
202215
'magento_root/docker/global.php.dist',
203216
[
204217
'MAGENTO_RUN_MODE' => 'production',
218+
'DEBUG' => false,
219+
'PHP_ENABLE_XDEBUG' => true,
205220
],
206221
],
207222
]);
208223
$this->fileMock->expects($this->exactly(2))
209224
->method('filePutContents')
210-
->willReturnMap([
225+
->withConsecutive(
211226
[
212227
'magento_root/docker/config.env',
213-
$this->contains('MAGENTO_CLOUD_VARIABLES=eyJBRE1JTl9FTUFJT'),
228+
$this->stringStartsWith('MAGENTO_CLOUD_VARIABLES=eyJBRE1JTl9FTUFJT'),
214229
],
215230
[
216231
'magento_root/docker/global.env',
217-
'MAGENTO_RUN_MODE=InByb2R1Y3Rpb24i',
218-
],
219-
]);
232+
implode(PHP_EOL, [
233+
'MAGENTO_RUN_MODE=production',
234+
'DEBUG=false',
235+
'PHP_ENABLE_XDEBUG=true',
236+
]) . PHP_EOL,
237+
]
238+
);
220239
$this->fileMock->expects($this->exactly(2))
221240
->method('deleteFile')
222241
->withConsecutive(

0 commit comments

Comments
 (0)