forked from magento/magento-cloud-docker
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBuildComposeTest.php
More file actions
119 lines (110 loc) · 4.33 KB
/
BuildComposeTest.php
File metadata and controls
119 lines (110 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\CloudDocker\Test\Integration;
use Magento\CloudDocker\Command\BuildCompose;
use Magento\CloudDocker\Compose\BuilderFactory;
use Magento\CloudDocker\Config\ConfigFactory;
use Magento\CloudDocker\Config\Dist\Generator;
use Magento\CloudDocker\Config\Source\CliSource;
use Magento\CloudDocker\Config\Source\SourceFactory;
use Magento\CloudDocker\Filesystem\Filesystem;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Magento\CloudDocker\App\GenericException;
use ReflectionException;
/**
* @inheritDoc
*/
class BuildComposeTest extends TestCase
{
/**
* @param string $directory
* @param array $options
*
* @throws GenericException
* @throws ReflectionException
*
* @dataProvider buildDataProvider
*/
public function testBuild(string $directory, array $options): void
{
$container = Container::getInstance(__DIR__ . '/_files', $directory);
/** @var Filesystem $filesystem */
$filesystem = $container->get(Filesystem::class);
$command = new BuildCompose(
$container->get(BuilderFactory::class),
$container->get(Generator::class),
$container->get(ConfigFactory::class),
$container->get(Filesystem::class),
$container->get(SourceFactory::class)
);
/** @var MockObject|InputInterface $inputMock */
$inputMock = $this->getMockForAbstractClass(InputInterface::class);
$inputMock->method('getOption')
->willReturnMap($options);
/** @var MockObject|OutputInterface $outputMock */
$outputMock = $this->getMockForAbstractClass(OutputInterface::class);
$command->execute($inputMock, $outputMock);
$this->assertSame(
$filesystem->get($directory . '/docker-compose.exp.yml'),
$filesystem->get($directory . '/docker-compose.yml')
);
}
/**
* @return array
*/
public function buildDataProvider(): array
{
return [
'cloud-base' => [
__DIR__ . '/_files/cloud_base',
[
[CliSource::OPTION_MODE, BuilderFactory::BUILDER_PRODUCTION],
[CliSource::OPTION_WITH_ENTRYPOINT, true],
[CliSource::OPTION_WITH_MARIADB_CONF, true]
]
],
'cloud-base-mftf' => [
__DIR__ . '/_files/cloud_base_mftf',
[
[CliSource::OPTION_MODE, BuilderFactory::BUILDER_PRODUCTION],
[CliSource::OPTION_WITH_SELENIUM, true],
[CliSource::OPTION_WITH_TEST, true],
[CliSource::OPTION_WITH_CRON, true],
[CliSource::OPTION_WITH_XDEBUG, true],
[CliSource::OPTION_ES, '5.2'],
[CliSource::OPTION_NO_ES, true],
[CliSource::OPTION_DB_INCREMENT_INCREMENT, 3],
[CliSource::OPTION_DB_INCREMENT_OFFSET, 2],
[CliSource::OPTION_WITH_ENTRYPOINT, true],
[CliSource::OPTION_WITH_MARIADB_CONF, true],
[CliSource::OPTION_TLS_PORT, '4443'],
[CliSource::OPTION_NO_MAILHOG, true]
]
],
'cloud-base-test' => [
__DIR__ . '/_files/cloud_base_test',
[
[CliSource::OPTION_MODE, BuilderFactory::BUILDER_PRODUCTION],
[CliSource::OPTION_WITH_TEST, true],
[CliSource::OPTION_WITH_CRON, true],
[CliSource::OPTION_WITH_XDEBUG, true],
[CliSource::OPTION_ES, '5.2'],
[CliSource::OPTION_NO_ES, true],
[CliSource::OPTION_DB_INCREMENT_INCREMENT, 3],
[CliSource::OPTION_DB_INCREMENT_OFFSET, 2],
[CliSource::OPTION_WITH_ENTRYPOINT, true],
[CliSource::OPTION_WITH_MARIADB_CONF, true],
[CliSource::OPTION_TLS_PORT, '4443'],
[CliSource::OPTION_NO_MAILHOG, true]
]
]
];
}
}