9
9
10
10
use org \bovigo \vfs \vfsStream ;
11
11
use org \bovigo \vfs \vfsStreamDirectory ;
12
+ use PHPUnit \Framework \ExpectationFailedException ;
12
13
use PHPUnit \Framework \TestCase ;
13
14
use Zend \ComponentInstaller \Collection ;
14
15
use Zend \ComponentInstaller \ConfigDiscovery ;
@@ -95,22 +96,22 @@ public function createModulesConfig()
95
96
public function assertOptionsContainsNoopInjector (Collection $ options )
96
97
{
97
98
if ($ options ->isEmpty ()) {
98
- $ this -> fail ('Options array is empty; no NoopInjector found! ' );
99
+ throw new ExpectationFailedException ('Options array is empty; no NoopInjector found! ' );
99
100
}
100
101
101
102
$ options = $ options ->toArray ();
102
103
$ injector = array_shift ($ options )->getInjector ();
103
104
104
105
if (! $ injector instanceof NoopInjector) {
105
- $ this -> fail ('Options array does not contain a NoopInjector! ' );
106
+ throw new ExpectationFailedException ('Options array does not contain a NoopInjector! ' );
106
107
}
107
108
}
108
109
109
110
public function assertOptionsContainsInjector ($ injectorType , Collection $ options )
110
111
{
111
112
foreach ($ options as $ option ) {
112
113
if (! $ option instanceof ConfigOption) {
113
- $ this -> fail (sprintf (
114
+ throw new ExpectationFailedException (sprintf (
114
115
'Invalid option returned: %s ' ,
115
116
is_object ($ option ) ? get_class ($ option ) : gettype ($ option )
116
117
));
@@ -121,7 +122,7 @@ public function assertOptionsContainsInjector($injectorType, Collection $options
121
122
}
122
123
}
123
124
124
- $ this -> fail (sprintf (
125
+ throw new ExpectationFailedException (sprintf (
125
126
'Injector of type %s was not found in the options ' ,
126
127
$ injectorType
127
128
));
@@ -133,7 +134,7 @@ public function assertOptionsContainsInjectorInChain($injectorType, Collection $
133
134
134
135
foreach ($ chain ->getCollection () as $ injector ) {
135
136
if (! $ injector instanceof InjectorInterface) {
136
- $ this -> fail (sprintf (
137
+ throw new ExpectationFailedException (sprintf (
137
138
'Invalid Injector returned: %s ' ,
138
139
is_object ($ injector ) ? get_class ($ injector ) : gettype ($ injector )
139
140
));
@@ -144,7 +145,7 @@ public function assertOptionsContainsInjectorInChain($injectorType, Collection $
144
145
}
145
146
}
146
147
147
- $ this -> fail (sprintf (
148
+ throw new ExpectationFailedException (sprintf (
148
149
'Injector of type %s was not found in the options ' ,
149
150
$ injectorType
150
151
));
0 commit comments