Skip to content

Commit 238ec28

Browse files
Remove deprecated things
1 parent 89f7056 commit 238ec28

10 files changed

+184
-420
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## Unreleased
3+
## v2.0.0
44

55
- Use a breadcrumb path to test only one particular part of the configuration node tree.
66

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013 Matthias Noback
1+
Copyright (c) 2013-2015 Matthias Noback
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

PhpUnit/AbstractConfigurationTestCase.php

Lines changed: 0 additions & 118 deletions
This file was deleted.

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
}

README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ Using Composer:
1616

1717
## Usage
1818

19-
### php 5.4 and up
20-
21-
Create a test case and use the trait from ``Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait``.
19+
Create a test case and use the trait from ``Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait``.
2220
Then implement ``getConfiguration()``:
2321

2422
```php
@@ -35,23 +33,6 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
3533
}
3634
```
3735

38-
### php 5.3
39-
40-
Create a test case and extend from ``Matthias\SymfonyConfigTest\PhpUnit\AbstractConfigurationTestCase``. Then implement
41-
``getConfiguration()``:
42-
43-
```php
44-
<?php
45-
46-
class ConfigurationTest extends AbstractConfigurationTestCase
47-
{
48-
protected function getConfiguration()
49-
{
50-
return new Configuration();
51-
}
52-
}
53-
```
54-
5536
### Test invalid configuration values
5637

5738
Let's assume the ``Configuration`` class you want to test looks like this:

Tests/PhpUnit/AbstractConfigurationTestCaseTest.php

Lines changed: 0 additions & 135 deletions
This file was deleted.

0 commit comments

Comments
 (0)