14
14
*
15
15
* @group php82
16
16
*/
17
- class RedisCest extends AbstractCest
17
+ class Redis82Cest extends RedisCest
18
18
{
19
- /**
20
- * @inheritdoc
21
- */
22
- public function _before (\CliTester $ I ): void
23
- {
24
- //Do nothing...
25
- }
26
-
27
- /**
28
- * @param \CliTester $I
29
- * @return array
30
- */
31
- private function getConfig (\CliTester $ I ): array
32
- {
33
- $ destination = sys_get_temp_dir () . '/app/etc/env.php ' ;
34
- $ I ->assertTrue ($ I ->downloadFromContainer ('/app/etc/env.php ' , $ destination , Docker::DEPLOY_CONTAINER ));
35
- return require $ destination ;
36
- }
37
-
38
- /**
39
- * @param \CliTester $I
40
- * @param \Codeception\Example $data
41
- * @throws \Robo\Exception\TaskException
42
- * @dataProvider defaultConfigurationDataProvider
43
- */
44
- public function testDefaultConfiguration (\CliTester $ I , \Codeception \Example $ data ): void
45
- {
46
- $ this ->prepareWorkplace ($ I , $ data ['version ' ]);
47
- $ I ->generateDockerCompose (sprintf (
48
- '--mode=production --expose-db-port=%s ' ,
49
- $ I ->getExposedPort ()
50
- ));
51
-
52
- $ I ->assertTrue ($ I ->runDockerComposeCommand ('run build cloud-build ' ), 'Build phase was failed ' );
53
- $ I ->assertTrue ($ I ->startEnvironment (), 'Docker could not start ' );
54
- $ I ->assertTrue ($ I ->runDockerComposeCommand ('run deploy cloud-deploy ' ), 'Deploy phase was failed ' );
55
- $ I ->assertTrue ($ I ->runDockerComposeCommand ('run deploy cloud-post-deploy ' ), 'Post Deploy phase was failed ' );
56
-
57
- $ config = $ this ->getConfig ($ I );
58
-
59
- $ I ->assertSame (
60
- 'Cm_Cache_Backend_Redis ' ,
61
- $ config ['cache ' ]['frontend ' ]['default ' ]['backend ' ],
62
- 'Wrong backend model '
63
- );
64
- $ this ->checkArraySubset (
65
- [
66
- 'backend_options ' => [
67
- 'server ' => 'redis ' ,
68
- 'port ' => '6379 ' ,
69
- 'database ' => 1 ,
70
- ]
71
- ],
72
- $ config ['cache ' ]['frontend ' ]['default ' ],
73
- $ I
74
- );
75
- $ I ->assertSame (
76
- 'Cm_Cache_Backend_Redis ' ,
77
- $ config ['cache ' ]['frontend ' ]['page_cache ' ]['backend ' ],
78
- 'Wrong backend model '
79
- );
80
- $ this ->checkArraySubset (
81
- [
82
- 'backend_options ' => [
83
- 'server ' => 'redis ' ,
84
- 'port ' => '6379 ' ,
85
- 'database ' => 2 ,
86
- ]
87
- ],
88
- $ config ['cache ' ]['frontend ' ]['page_cache ' ],
89
- $ I
90
- );
91
- $ I ->assertArrayNotHasKey ('type ' , $ config ['cache ' ]);
92
-
93
- $ I ->amOnPage ('/ ' );
94
- $ I ->see ('Home page ' );
95
- $ I ->see ('CMS homepage content goes here. ' );
96
- }
97
-
98
19
/**
99
20
* @return array
100
21
*/
@@ -107,29 +28,6 @@ protected function defaultConfigurationDataProvider(): array
107
28
];
108
29
}
109
30
110
- /**
111
- * @param \CliTester $I
112
- * @param \Codeception\Example $data
113
- * @throws \Robo\Exception\TaskException
114
- * @dataProvider wrongConfigurationRedisBackendDataProvider
115
- */
116
- public function testWrongConfigurationRedisBackend (\CliTester $ I , \Codeception \Example $ data ): void
117
- {
118
- $ this ->prepareWorkplace ($ I , $ data ['version ' ]);
119
- $ I ->generateDockerCompose (sprintf (
120
- '--mode=production --expose-db-port=%s ' ,
121
- $ I ->getExposedPort ()
122
- ));
123
-
124
- $ I ->writeEnvMagentoYaml ($ data ['wrongConfiguration ' ]);
125
-
126
- $ I ->assertSame ($ data ['buildSuccess ' ], $ I ->runDockerComposeCommand ('run build cloud-build ' ));
127
- $ I ->seeInOutput ($ data ['errorBuildMessage ' ]);
128
- $ I ->assertTrue ($ I ->startEnvironment (), 'Docker could not start ' );
129
- $ I ->assertSame ($ data ['deploySuccess ' ], $ I ->runDockerComposeCommand ('run build cloud-deploy ' ));
130
- $ I ->seeInOutput ($ data ['errorDeployMessage ' ]);
131
- }
132
-
133
31
/**
134
32
* @return array
135
33
*/
@@ -156,27 +54,6 @@ protected function wrongConfigurationRedisBackendDataProvider(): array
156
54
];
157
55
}
158
56
159
- /**
160
- * @param \CliTester $I
161
- * @param \Codeception\Example $data
162
- * @throws \Robo\Exception\TaskException
163
- * @dataProvider redisWrongConnectionDataProvider
164
- */
165
- public function testRedisWrongConnection (\CliTester $ I , \Codeception \Example $ data ): void
166
- {
167
- $ this ->prepareWorkplace ($ I , $ data ['version ' ]);
168
- $ I ->generateDockerCompose (sprintf (
169
- '--mode=production --expose-db-port=%s ' ,
170
- $ I ->getExposedPort ()
171
- ));
172
-
173
- $ I ->writeEnvMagentoYaml ($ data ['configuration ' ]);
174
-
175
- $ I ->assertTrue ($ I ->runDockerComposeCommand ('run build cloud-build ' ), 'Build phase was failed ' );
176
- $ I ->assertTrue ($ I ->startEnvironment (), 'Docker could not start ' );
177
- $ I ->assertFalse ($ I ->runDockerComposeCommand ('run deploy cloud-deploy ' ), 'Deploy phase was successful ' );
178
- }
179
-
180
57
/**
181
58
* @return array
182
59
*/
@@ -227,45 +104,6 @@ protected function redisWrongConnectionDataProvider(): array
227
104
];
228
105
}
229
106
230
- /**
231
- * @param \CliTester $I
232
- * @param \Codeception\Example $data
233
- * @throws \Robo\Exception\TaskException
234
- * @dataProvider goodConfigurationDataProvider
235
- */
236
- public function testGoodConfiguration (\CliTester $ I , \Codeception \Example $ data ): void
237
- {
238
- $ this ->prepareWorkplace ($ I , $ data ['version ' ]);
239
- $ I ->generateDockerCompose (sprintf (
240
- '--mode=production --expose-db-port=%s ' ,
241
- $ I ->getExposedPort ()
242
- ));
243
-
244
- $ I ->writeEnvMagentoYaml ($ data ['configuration ' ]);
245
-
246
- $ I ->assertTrue ($ I ->runDockerComposeCommand ('run build cloud-build ' ), 'Build phase was failed ' );
247
- $ I ->assertTrue ($ I ->startEnvironment (), 'Docker could not start ' );
248
- $ I ->assertTrue ($ I ->runDockerComposeCommand ('run deploy cloud-deploy ' ), 'Deploy phase was failed ' );
249
- $ I ->assertTrue ($ I ->runDockerComposeCommand ('run deploy cloud-post-deploy ' ), 'Post Deploy phase was failed ' );
250
-
251
- $ config = $ this ->getConfig ($ I );
252
- $ I ->assertSame (
253
- $ data ['expectedBackend ' ],
254
- $ config ['cache ' ]['frontend ' ]['default ' ]['backend ' ],
255
- 'Wrong backend model '
256
- );
257
-
258
- $ this ->checkArraySubset (
259
- $ data ['expectedConfig ' ],
260
- $ config ['cache ' ]['frontend ' ]['default ' ],
261
- $ I
262
- );
263
-
264
- $ I ->amOnPage ('/ ' );
265
- $ I ->see ('Home page ' );
266
- $ I ->see ('CMS homepage content goes here. ' );
267
- }
268
-
269
107
/**
270
108
* @return array
271
109
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
0 commit comments