Skip to content

Commit 111e111

Browse files
author
Silvan Thus
committed
Adds tests: throws exception when missing when option exception-when-missing is true, and combines dist when exception-when-missing is false
1 parent 9cf0f8a commit 111e111

File tree

6 files changed

+35
-0
lines changed

6 files changed

+35
-0
lines changed

Tests/ProcessorTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public function testParameterHandling($testCaseName)
101101
'dist-file' => 'parameters.yml.dist',
102102
'environment' => array(),
103103
'interactive' => false,
104+
'expect-exception' => false,
104105
),
105106
(array) Yaml::parse(file_get_contents($dataDir.'/setup.yml'))
106107
);
@@ -112,6 +113,10 @@ public function testParameterHandling($testCaseName)
112113
$this->io->write($message)->shouldBeCalled();
113114

114115
$this->setInteractionExpectations($testCase);
116+
117+
if (!empty($testCase['expect-exception'])) {
118+
$this->setExpectedException($testCase['expect-exception']);
119+
}
115120

116121
$this->processor->processFile($testCase['config']);
117122

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
parameters:
2+
provided: foo
3+
missing: bar
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
title: Missing keys in the environment will cause a throw when the option is set to true
2+
3+
config:
4+
env-map:
5+
provided: IC_TEST_PROVIDED
6+
exception-when-missing: true
7+
8+
environment:
9+
IC_TEST_PROVIDED: bar
10+
11+
expect-exception: "InvalidArgumentException"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
parameters:
2+
provided: foo
3+
missing: bar
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This file is auto-generated during the composer install
2+
parameters:
3+
provided: bar
4+
missing: bar
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
title: Missing keys in the environment will not cause a throw when the option is set to false
2+
3+
config:
4+
env-map:
5+
provided: IC_TEST_PROVIDED
6+
exception-when-missing: false
7+
8+
environment:
9+
IC_TEST_PROVIDED: bar

0 commit comments

Comments
 (0)