@@ -24,15 +24,15 @@ protected function tearDown(): void
24
24
25
25
public function test_build_command_no_build_args ()
26
26
{
27
- $ command = Docker::buildCommand ('my-project ' , 'production ' , [], []);
27
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , [], [], [], [] );
28
28
$ expectedCommand = 'docker build --pull --file=production.Dockerfile --tag=my-project:production . ' ;
29
29
$ this ->assertEquals ($ expectedCommand , $ command );
30
30
}
31
31
32
32
public function test_build_command_cli_build_args ()
33
33
{
34
34
$ cliBuildArgs = ['FOO=BAR ' , 'FIZZ=BUZZ ' ];
35
- $ command = Docker::buildCommand ('my-project ' , 'production ' , $ cliBuildArgs , []);
35
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , $ cliBuildArgs , [], [], [] );
36
36
$ expectedCommand = 'docker build --pull --file=production.Dockerfile --tag=my-project:production ' .
37
37
"--build-arg='FOO=BAR' --build-arg='FIZZ=BUZZ' . " ;
38
38
$ this ->assertEquals ($ expectedCommand , $ command );
@@ -41,7 +41,7 @@ public function test_build_command_cli_build_args()
41
41
public function test_build_command_manifest_build_args ()
42
42
{
43
43
$ manifestBuildArgs = ['FOO ' => 'BAR ' , 'FIZZ ' => 'BUZZ ' ];
44
- $ command = Docker::buildCommand ('my-project ' , 'production ' , [], $ manifestBuildArgs );
44
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , [], $ manifestBuildArgs, [], [] );
45
45
$ expectedCommand = 'docker build --pull --file=production.Dockerfile --tag=my-project:production ' .
46
46
"--build-arg='FOO=BAR' --build-arg='FIZZ=BUZZ' . " ;
47
47
$ this ->assertEquals ($ expectedCommand , $ command );
@@ -51,12 +51,50 @@ public function test_build_command_cli_and_manifest_build_args()
51
51
{
52
52
$ cliBuildArgs = ['BAR=FOO ' , 'FIZZ=BAZZ ' ];
53
53
$ manifestBuildArgs = ['FOO ' => 'BAR ' , 'FIZZ ' => 'BUZZ ' ];
54
- $ command = Docker::buildCommand ('my-project ' , 'production ' , $ cliBuildArgs , $ manifestBuildArgs );
54
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , $ cliBuildArgs , $ manifestBuildArgs, [], [] );
55
55
$ expectedCommand = 'docker build --pull --file=production.Dockerfile --tag=my-project:production ' .
56
56
"--build-arg='FOO=BAR' --build-arg='FIZZ=BAZZ' --build-arg='BAR=FOO' . " ;
57
57
$ this ->assertEquals ($ expectedCommand , $ command );
58
58
}
59
59
60
+ public function test_build_command_cli_docker_options ()
61
+ {
62
+ $ cliBuildOptions = ['BAR=FOO ' , 'FIZZ=BAZZ ' , 'FIZZLE ' , 'BUZZLE ' ];
63
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , [], [], $ cliBuildOptions , []);
64
+ $ expectedCommand = 'docker build --pull --file=production.Dockerfile --tag=my-project:production ' .
65
+ "--BAR='FOO' --FIZZ='BAZZ' --FIZZLE --BUZZLE . " ;
66
+ $ this ->assertEquals ($ expectedCommand , $ command );
67
+ }
68
+
69
+ public function test_build_command_manifest_docker_options ()
70
+ {
71
+ $ manifestBuildOptions = [['FOO ' => 'BAR ' ], ['FIZZ ' => 'BUZZ ' ], 'FIZZLE ' , 'BUZZLE ' ];
72
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , [], [], [], $ manifestBuildOptions );
73
+ $ expectedCommand = 'docker build --pull --file=production.Dockerfile --tag=my-project:production ' .
74
+ "--FOO='BAR' --FIZZ='BUZZ' --FIZZLE --BUZZLE . " ;
75
+ $ this ->assertEquals ($ expectedCommand , $ command );
76
+ }
77
+
78
+ public function test_build_command_cli_and_manifest_docker_args ()
79
+ {
80
+ $ cliBuildOptions = ['BAR=FOO ' , 'FIZZ=BAZZ ' , 'FIZZLE ' , 'BUZZLE ' ];
81
+ $ manifestBuildOptions = [['FOO ' => 'BAR ' ], ['FIZZ ' => 'BUZZ ' ], 'FIZZLY ' , 'BUZZLY ' ];
82
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , [], [], $ cliBuildOptions , $ manifestBuildOptions );
83
+ $ expectedCommand = 'docker build --pull --file=production.Dockerfile --tag=my-project:production ' .
84
+ "--FOO='BAR' --FIZZ='BAZZ' --FIZZLY --BUZZLY --BAR='FOO' --FIZZLE --BUZZLE . " ;
85
+ $ this ->assertEquals ($ expectedCommand , $ command );
86
+ }
87
+
88
+ public function test_build_command_cli_docker_options_and_cli_build_args ()
89
+ {
90
+ $ cliBuildOptions = ['BAR=FOO ' , 'FIZZ=BAZZ ' ];
91
+ $ cliBuildArgs = ['BAR=FOO ' , 'FIZZ=BAZZ ' ];
92
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , $ cliBuildArgs , [], $ cliBuildOptions , []);
93
+ $ expectedCommand = 'docker build --pull --file=production.Dockerfile --tag=my-project:production ' .
94
+ "--build-arg='BAR=FOO' --build-arg='FIZZ=BAZZ' --BAR='FOO' --FIZZ='BAZZ' . " ;
95
+ $ this ->assertEquals ($ expectedCommand , $ command );
96
+ }
97
+
60
98
public function test_dockerfile_from_manifest ()
61
99
{
62
100
file_put_contents (Container::getInstance ()->offsetGet ('manifest ' ), Yaml::dump ([
@@ -69,7 +107,7 @@ public function test_dockerfile_from_manifest()
69
107
],
70
108
],
71
109
]));
72
- $ command = Docker::buildCommand ('my-project ' , 'production ' , [], []);
110
+ $ command = Docker::buildCommand ('my-project ' , 'production ' , [], [], [], [] );
73
111
$ expectedCommand = 'docker build --pull --file=docker/shared.Dockerfile --tag=my-project:production . ' ;
74
112
$ this ->assertEquals ($ expectedCommand , $ command );
75
113
}
0 commit comments