Skip to content

Commit e4e8c1f

Browse files
Matthias NobackMatthias Noback
authored andcommitted
Synchronize trait with base test class
1 parent 9e1d553 commit e4e8c1f

File tree

1 file changed

+44
-5
lines changed

1 file changed

+44
-5
lines changed

PhpUnit/ConfigurationTestCaseTrait.php

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,75 @@ protected function assertConfigurationIsInvalid(array $configurationValues, $exp
4040
);
4141
}
4242

43+
/**
44+
* Assert that the given configuration values are invalid.
45+
*
46+
* Optionally provide (part of) the exception message that you expect to receive.
47+
*
48+
* When running PHPUnit >=4.3.0, you need to set useRegExp to true if you'd like
49+
* to match the exception message using a regular expression.
50+
*
51+
* @param array $configurationValues
52+
* @param string $breadcrumbPath The path that should be validated, e.g. "doctrine.orm"
53+
* @param string|null $expectedMessage
54+
* @param bool $useRegExp
55+
*/
56+
protected function assertPartialConfigurationIsInvalid(
57+
array $configurationValues,
58+
$breadcrumbPath,
59+
$expectedMessage = null,
60+
$useRegExp = false
61+
) {
62+
\PHPUnit_Framework_TestCase::assertThat(
63+
$configurationValues,
64+
new ConfigurationValuesAreInvalidConstraint(
65+
$this->getConfiguration(),
66+
$expectedMessage,
67+
$useRegExp,
68+
$breadcrumbPath
69+
)
70+
);
71+
}
72+
4373
/**
4474
* Assert that the given configuration values are valid.
4575
*
76+
* Optionally provide the part of the configuration that you want to test, e.g. "doctrine.orm"
77+
*
4678
* @param array $configurationValues
79+
* @param string|null $breadcrumbPath
4780
*/
48-
protected function assertConfigurationIsValid(array $configurationValues)
81+
protected function assertConfigurationIsValid(array $configurationValues, $breadcrumbPath = null)
4982
{
5083
\PHPUnit_Framework_TestCase::assertThat(
5184
$configurationValues,
5285
new ConfigurationValuesAreValidConstraint(
53-
$this->getConfiguration()
86+
$this->getConfiguration(),
87+
$breadcrumbPath
5488
)
5589
);
5690
}
5791

5892
/**
59-
* Assert that the given configuration values, when processed, will equal to the given array
93+
* Assert that the given configuration values, when processed, will equal to the given array.
94+
*
95+
* Optionally provide the part of the configuration that you want to test, e.g. "doctrine.orm"
6096
*
6197
* @param array $configurationValues
6298
* @param array $expectedProcessedConfiguration
99+
* @param string|null $breadcrumbPath
63100
*/
64101
protected function assertProcessedConfigurationEquals(
65102
array $configurationValues,
66-
array $expectedProcessedConfiguration
103+
array $expectedProcessedConfiguration,
104+
$breadcrumbPath = null
67105
) {
68106
\PHPUnit_Framework_TestCase::assertThat(
69107
$expectedProcessedConfiguration,
70108
new ProcessedConfigurationEqualsConstraint(
71109
$this->getConfiguration(),
72-
$configurationValues
110+
$configurationValues,
111+
$breadcrumbPath
73112
)
74113
);
75114
}

0 commit comments

Comments
 (0)