File tree Expand file tree Collapse file tree 2 files changed +33
-13
lines changed Expand file tree Collapse file tree 2 files changed +33
-13
lines changed Original file line number Diff line number Diff line change 2
2
3
3
All notable changes of the PHPUnit 5.5 release series are documented in this file using the [ Keep a CHANGELOG] ( http://keepachangelog.com/ ) principles.
4
4
5
+ ## [ 5.5.6] - 2016-MM-DD
6
+
7
+ ### Fixed
8
+
9
+ * Fixed [ #2261 ] ( https://github.com/sebastianbergmann/phpunit/issues/2261 ) : Invalid test listener configuration leads to confusing behavior
10
+
5
11
## [ 5.5.5] - 2016-09-21
6
12
7
13
### Fixed
@@ -46,6 +52,7 @@ New release of PHPUnit as PHAR with updated dependencies
46
52
47
53
* An ` AssertionError ` raised by an ` assert() ` in the tested code now causes the test to be interpreted as a failure instead of an error
48
54
55
+ [ 5.5.6 ] : https://github.com/sebastianbergmann/phpunit/compare/5.5.5...5.5.6
49
56
[ 5.5.5 ] : https://github.com/sebastianbergmann/phpunit/compare/5.5.4...5.5.5
50
57
[ 5.5.4 ] : https://github.com/sebastianbergmann/phpunit/compare/5.5.3...5.5.4
51
58
[ 5.5.3 ] : https://github.com/sebastianbergmann/phpunit/compare/5.5.2...5.5.3
Original file line number Diff line number Diff line change @@ -882,22 +882,35 @@ protected function handleConfiguration(array &$arguments)
882
882
require_once $ listener ['file ' ];
883
883
}
884
884
885
- if (class_exists ($ listener ['class ' ])) {
886
- if (count ($ listener ['arguments ' ]) == 0 ) {
887
- $ listener = new $ listener ['class ' ];
888
- } else {
889
- $ listenerClass = new ReflectionClass (
885
+ if (!class_exists ($ listener ['class ' ])) {
886
+ throw new PHPUnit_Framework_Exception (
887
+ sprintf (
888
+ 'Class "%s" does not exist ' ,
890
889
$ listener ['class ' ]
891
- );
892
- $ listener = $ listenerClass ->newInstanceArgs (
893
- $ listener ['arguments ' ]
894
- );
895
- }
890
+ )
891
+ );
892
+ }
896
893
897
- if ($ listener instanceof PHPUnit_Framework_TestListener) {
898
- $ arguments ['listeners ' ][] = $ listener ;
899
- }
894
+ $ listenerClass = new ReflectionClass ($ listener ['class ' ]);
895
+
896
+ if (!$ listenerClass ->implementsInterface (PHPUnit_Framework_TestListener::class)) {
897
+ throw new PHPUnit_Framework_Exception (
898
+ sprintf (
899
+ 'Class "%s" does not implement the PHPUnit_Framework_TestListener interface ' ,
900
+ $ listener ['class ' ]
901
+ )
902
+ );
903
+ }
904
+
905
+ if (count ($ listener ['arguments ' ]) == 0 ) {
906
+ $ listener = new $ listener ['class ' ];
907
+ } else {
908
+ $ listener = $ listenerClass ->newInstanceArgs (
909
+ $ listener ['arguments ' ]
910
+ );
900
911
}
912
+
913
+ $ arguments ['listeners ' ][] = $ listener ;
901
914
}
902
915
903
916
$ loggingConfiguration = $ arguments ['configuration ' ]->getLoggingConfiguration ();
You can’t perform that action at this time.
0 commit comments