@@ -45,6 +45,7 @@ public function testLoadsMinimalConfigurationWithDefaults(): void
4545 self ::assertSame (self ::REVISION , $ configuration ->revision );
4646 self ::assertNull ($ configuration ->directory );
4747 self ::assertSame ('dev ' , $ configuration ->environment );
48+ self ::assertSame ([], $ configuration ->environmentVariables );
4849 self ::assertSame ('composer ' , $ configuration ->setup );
4950 self ::assertTrue ($ configuration ->ci );
5051 self ::assertSame (120 , $ configuration ->indexTimeout );
@@ -61,6 +62,10 @@ public function testLoadsFullConfiguration(): void
6162 'revision ' => self ::REVISION ,
6263 'directory ' => 'twig.symfony.com ' ,
6364 'environment ' => 'test ' ,
65+ 'environmentVariables ' => [
66+ 'DATABASE_URL ' => 'mysql://root@127.0.0.1:9/app ' ,
67+ 'APP_SECRET ' => 'dogfood-not-a-secret ' ,
68+ ],
6469 'setup ' => 'composer ' ,
6570 'ci ' => false ,
6671 'indexTimeout ' => 300 ,
@@ -75,6 +80,10 @@ public function testLoadsFullConfiguration(): void
7580 self ::assertSame ('twig.symfony.com ' , $ configuration ->name );
7681 self ::assertSame ('twig.symfony.com ' , $ configuration ->directory );
7782 self ::assertSame ('test ' , $ configuration ->environment );
83+ self ::assertSame ([
84+ 'APP_SECRET ' => 'dogfood-not-a-secret ' ,
85+ 'DATABASE_URL ' => 'mysql://root@127.0.0.1:9/app ' ,
86+ ], $ configuration ->environmentVariables );
7887 self ::assertFalse ($ configuration ->ci );
7988 self ::assertSame (300 , $ configuration ->indexTimeout );
8089 self ::assertSame (20 , $ configuration ->requestTimeout );
@@ -176,6 +185,10 @@ public static function invalidConfigurationProvider(): iterable
176185 yield 'absolute directory ' => [['directory ' => '/srv ' ], 'relative path inside the repository ' ];
177186 yield 'parent directory ' => [['directory ' => '../other ' ], 'relative path inside the repository ' ];
178187 yield 'invalid environment ' => [['environment ' => 'dev; rm ' ], 'simple environment name ' ];
188+ yield 'environment variable list ' => [['environmentVariables ' => ['DATABASE_URL ' ]], 'map of environment variable names to string values ' ];
189+ yield 'invalid environment variable name ' => [['environmentVariables ' => ['database-url ' => 'value ' ]], 'map of environment variable names to string values ' ];
190+ yield 'non-string environment variable ' => [['environmentVariables ' => ['DATABASE_URL ' => 42 ]], 'map of environment variable names to string values ' ];
191+ yield 'null byte environment variable ' => [['environmentVariables ' => ['DATABASE_URL ' => "value \0suffix " ]], 'map of environment variable names to string values ' ];
179192 yield 'unknown setup ' => [['setup ' => 'shell ' ], 'The "setup" in ' ];
180193 yield 'missing ci ' => [['ci ' => null ], 'boolean "ci" ' ];
181194 yield 'string ci ' => [['ci ' => 'yes ' ], 'boolean "ci" ' ];
0 commit comments