Skip to content

Commit 4322653

Browse files
committed
php8.2 tests optimization
1 parent 9487d0a commit 4322653

File tree

5 files changed

+0
-266
lines changed

5 files changed

+0
-266
lines changed

src/Test/Functional/Acceptance/Acceptance82Cest.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,4 @@ class Acceptance82Cest extends AcceptanceCest
1818
* Template version for testing
1919
*/
2020
protected const TEMPLATE_VERSION = '2.4.6';
21-
22-
/**
23-
* @param \CliTester $I
24-
* @throws TaskException
25-
*/
26-
public function testProductionMode(\CliTester $I): void
27-
{
28-
$I->assertTrue($I->generateDockerCompose('--mode=production'), 'Command build:compose failed');
29-
$I->replaceImagesWithCustom();
30-
$I->startEnvironment();
31-
$I->runDockerComposeCommand('run build cloud-build');
32-
$I->runDockerComposeCommand('run deploy cloud-deploy');
33-
$I->runDockerComposeCommand('run deploy cloud-post-deploy');
34-
$I->amOnPage('/');
35-
$I->see('Home page');
36-
$I->see('CMS homepage content goes here.');
37-
}
38-
39-
/**
40-
* @param \CliTester $I
41-
* @throws TaskException
42-
* @throws \Codeception\Exception\ModuleConfigException
43-
* @throws \Codeception\Exception\ModuleException
44-
*/
45-
public function testCustomHost(\CliTester $I): void
46-
{
47-
$I->updateBaseUrl('http://magento2.test/');
48-
$I->assertTrue(
49-
$I->generateDockerCompose('--mode=production --host=magento2.test'),
50-
'Command build:compose failed'
51-
);
52-
$I->replaceImagesWithCustom();
53-
$I->startEnvironment();
54-
$I->assertTrue($I->runDockerComposeCommand('run build cloud-build'), 'Build phase failed');
55-
$I->assertTrue($I->runDockerComposeCommand('run deploy cloud-deploy'), 'Deploy phase failed');
56-
$I->assertTrue($I->runDockerComposeCommand('run deploy cloud-post-deploy'), 'Post deploy phase failed');
57-
$I->amOnPage('/');
58-
$I->see('Home page');
59-
$I->see('CMS homepage content goes here.');
60-
}
6121
}

src/Test/Functional/Acceptance/Developer82Cest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,4 @@ class Developer82Cest extends DeveloperCest
1818
* Template version for testing
1919
*/
2020
protected const TEMPLATE_VERSION = '2.4.6';
21-
22-
/**
23-
* Tests that php settings contains configuration from php.dev.ini
24-
*
25-
* @param CliTester $I
26-
* @throws \Robo\Exception\TaskException
27-
*/
28-
public function testDevPhpIni(CliTester $I)
29-
{
30-
$I->generateDockerCompose('--mode=developer');
31-
$I->replaceImagesWithCustom();
32-
$I->startEnvironment();
33-
34-
$I->runDockerComposeCommand('run deploy php -i | grep opcache.validate_timestamps');
35-
$I->seeInOutput('=> On');
36-
37-
$I->runDockerComposeCommand('run fpm php -i | grep opcache.validate_timestamps');
38-
$I->seeInOutput('=> On');
39-
}
4021
}

src/Test/Functional/Acceptance/Elasticsearch82Cest.php

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -20,77 +20,4 @@ class Elasticsearch82Cest extends ElasticsearchCest
2020
* Template version for testing
2121
*/
2222
protected const TEMPLATE_VERSION = '2.4.6';
23-
24-
/**
25-
* @param CliTester $I
26-
* @param Example $data
27-
* @dataProvider dataProvider
28-
* @return void
29-
* @throws TaskException
30-
*/
31-
public function testElasticsearch(CliTester $I, Example $data)
32-
{
33-
$I->generateDockerCompose($this->buildCommand($data));
34-
$I->replaceImagesWithCustom();
35-
$I->startEnvironment();
36-
if (!empty($data['plugins'])) {
37-
$I->runDockerComposeCommand('logs elasticsearch');
38-
foreach ($data['plugins'] as $plugin) {
39-
$I->seeInOutput($plugin);
40-
}
41-
}
42-
$I->runDockerComposeCommand('exec -T elasticsearch ps aux | grep elasticsearch');
43-
$I->seeInOutput('-Xms' . $data['xms']);
44-
$I->seeInOutput('-Xmx' . $data['xmx']);
45-
46-
if (!empty($data['param'])) {
47-
$I->runDockerComposeCommand('exec -T elasticsearch curl http://localhost:9200/_nodes/settings');
48-
$I->seeInOutput($data['param']['needle']);
49-
}
50-
}
51-
52-
/**
53-
* Builds build:compose command from given test data
54-
*
55-
* @param Example $data
56-
* @return string
57-
*/
58-
private function buildCommand(Example $data): string
59-
{
60-
$command = sprintf(
61-
'--mode=production --es=%s --es-env-var="ES_JAVA_OPTS=-Xms%s -Xmx%s" --no-os',
62-
$data['version'],
63-
$data['xms'],
64-
$data['xmx']
65-
);
66-
67-
if (!empty($data['param'])) {
68-
$command .= " --es-env-var={$data['param']['key']}={$data['param']['value']}";
69-
}
70-
if (!empty($data['plugins'])) {
71-
$command .= sprintf(' --es-env-var="ES_PLUGINS=%s"', implode(' ', $data['plugins']));
72-
}
73-
74-
return $command;
75-
}
76-
77-
/**
78-
* @return array
79-
*/
80-
protected function dataProvider(): array
81-
{
82-
return [
83-
[
84-
'version' => '7.10',
85-
'xms' => '520m',
86-
'xmx' => '520m',
87-
'plugins' => ['analysis-nori'],
88-
'param' => [
89-
'key' => 'node.store.allow_mmap',
90-
'value' => 'false',
91-
'needle' => '"store":{"allow_mmap":"false"}',
92-
]
93-
],
94-
];
95-
}
9623
}

src/Test/Functional/Acceptance/MailHog82Cest.php

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -16,55 +16,4 @@ class MailHog82Cest extends MailHogCest
1616
* Template version for testing
1717
*/
1818
protected const TEMPLATE_VERSION = '2.4.6';
19-
20-
/**
21-
* @param \CliTester $I
22-
* @throws \Exception
23-
*/
24-
public function testDefaultPorts(\CliTester $I): void
25-
{
26-
$I->updateBaseUrl('http://magento2.docker:8025/');
27-
$I->assertTrue(
28-
$I->generateDockerCompose(),
29-
'Command build:compose failed'
30-
);
31-
$this->runAndAssert($I);
32-
}
33-
34-
/**
35-
* @param \CliTester $I
36-
* @throws \Exception
37-
*/
38-
public function testCustomPorts(\CliTester $I): void
39-
{
40-
$I->updateBaseUrl('http://magento2.docker:8026/');
41-
$I->assertTrue(
42-
$I->generateDockerCompose('--mailhog-http-port=8026 --mailhog-smtp-port=1026'),
43-
'Command build:compose failed'
44-
);
45-
$this->runAndAssert($I);
46-
}
47-
48-
/**
49-
* @param \CliTester $I
50-
* @throws \Exception
51-
*/
52-
private function runAndAssert(\CliTester $I): void
53-
{
54-
$I->replaceImagesWithCustom();
55-
$I->startEnvironment();
56-
$I->amOnPage('/');
57-
$I->see('MailHog');
58-
59-
$I->sendAjaxGetRequest('/api/v2/messages', ['limit' => 10]);
60-
$I->seeResponseIsJson();
61-
$I->assertSame([0], $I->grabDataFromResponseByJsonPath('$.total'));
62-
63-
$I->assertTrue(
64-
$I->runDockerComposeCommand('run deploy bash -c "php -r \"mail(\'[email protected]\',\'test\',\'test\');\""')
65-
);
66-
$I->sendAjaxGetRequest('/api/v2/messages', ['limit' => 10]);
67-
$I->seeResponseIsJson();
68-
$I->assertSame([1], $I->grabDataFromResponseByJsonPath('$.total'));
69-
}
7019
}

src/Test/Functional/Acceptance/Opensearch82Cest.php

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -21,87 +21,4 @@ class Opensearch82Cest extends OpensearchCest
2121
*/
2222
protected const TEMPLATE_VERSION = '2.4.6';
2323

24-
/**
25-
* @param CliTester $I
26-
* @param Example $data
27-
* @dataProvider dataProvider
28-
* @return void
29-
* @throws TaskException
30-
*/
31-
public function testOpensearch(CliTester $I, Example $data)
32-
{
33-
$I->generateDockerCompose($this->buildCommand($data));
34-
$I->replaceImagesWithCustom();
35-
$I->startEnvironment();
36-
if (!empty($data['plugins'])) {
37-
$I->runDockerComposeCommand('logs opensearch');
38-
foreach ($data['plugins'] as $plugin) {
39-
$I->seeInOutput($plugin);
40-
}
41-
}
42-
$I->runDockerComposeCommand('exec -T opensearch curl localhost:9200/_nodes');
43-
$I->seeInOutput('-Xms' . $data['xms']);
44-
$I->seeInOutput('-Xmx' . $data['xmx']);
45-
46-
if (!empty($data['param'])) {
47-
$I->runDockerComposeCommand('exec -T opensearch curl http://localhost:9200/_nodes/settings');
48-
$I->seeInOutput($data['param']['needle']);
49-
}
50-
}
51-
52-
/**
53-
* Builds build:compose command from given test data
54-
*
55-
* @param Example $data
56-
* @return string
57-
*/
58-
private function buildCommand(Example $data): string
59-
{
60-
$command = sprintf(
61-
'--mode=production --os=%s --os-env-var="OPENSEARCH_JAVA_OPTS=-Xms%s -Xmx%s"',
62-
$data['version'],
63-
$data['xms'],
64-
$data['xmx']
65-
);
66-
67-
if (!empty($data['param'])) {
68-
$command .= " --os-env-var={$data['param']['key']}={$data['param']['value']}";
69-
}
70-
if (!empty($data['plugins'])) {
71-
$command .= sprintf(' --os-env-var="OS_PLUGINS=%s"', implode(' ', $data['plugins']));
72-
}
73-
74-
return $command;
75-
}
76-
77-
/**
78-
* @return array
79-
*/
80-
protected function dataProvider(): array
81-
{
82-
return [
83-
[
84-
'version' => '2.3',
85-
'xms' => '520m',
86-
'xmx' => '520m',
87-
'plugins' => ['analysis-nori'],
88-
'param' => [
89-
'key' => 'node.store.allow_mmap',
90-
'value' => 'false',
91-
'needle' => '"store":{"allow_mmap":"false"}',
92-
]
93-
],
94-
[
95-
'version' => '2.4',
96-
'xms' => '520m',
97-
'xmx' => '520m',
98-
'plugins' => ['analysis-nori'],
99-
'param' => [
100-
'key' => 'node.store.allow_mmap',
101-
'value' => 'false',
102-
'needle' => '"store":{"allow_mmap":"false"}',
103-
]
104-
],
105-
];
106-
}
10724
}

0 commit comments

Comments
 (0)