@@ -57,12 +57,12 @@ public function filterNullPass()
57
57
58
58
/**
59
59
* @test
60
- * @expectedException \TraderInteractive\Exceptions\FilterException
61
- * @expectedExceptionMessage Value failed filtering, $allowNull is set to false
62
60
* @covers ::filter
63
61
*/
64
62
public function filterNullFail ()
65
63
{
64
+ $ this ->expectException (\TraderInteractive \Exceptions \FilterException::class);
65
+ $ this ->expectExceptionMessage ('Value failed filtering, $allowNull is set to false ' );
66
66
Strings::filter (null );
67
67
}
68
68
@@ -77,11 +77,11 @@ public function filterMinLengthPass()
77
77
78
78
/**
79
79
* @test
80
- * @expectedException \TraderInteractive\Exceptions\FilterException
81
80
* @covers ::filter
82
81
*/
83
82
public function filterMinLengthFail ()
84
83
{
84
+ $ this ->expectException (\TraderInteractive \Exceptions \FilterException::class);
85
85
Strings::filter ('' );
86
86
}
87
87
@@ -96,56 +96,56 @@ public function filterMaxLengthPass()
96
96
97
97
/**
98
98
* @test
99
- * @expectedException \TraderInteractive\Exceptions\FilterException
100
- * @expectedExceptionMessage Value 'a' with length '1' is less than '0' or greater than '0'
101
99
* @covers ::filter
102
100
*/
103
101
public function filterMaxLengthFail ()
104
102
{
103
+ $ this ->expectException (\TraderInteractive \Exceptions \FilterException::class);
104
+ $ this ->expectExceptionMessage ("Value 'a' with length '1' is less than '0' or greater than '0' " );
105
105
Strings::filter ('a ' , false , 0 , 0 );
106
106
}
107
107
108
108
/**
109
109
* @test
110
- * @expectedException InvalidArgumentException
111
- * @expectedExceptionMessage $minLength was not a positive integer value
112
110
* @covers ::filter
113
111
*/
114
112
public function filterMinLengthNotInteger ()
115
113
{
114
+ $ this ->expectException (InvalidArgumentException::class);
115
+ $ this ->expectExceptionMessage ('$minLength was not a positive integer value ' );
116
116
Strings::filter ('a ' , false , -1 );
117
117
}
118
118
119
119
/**
120
120
* @test
121
- * @expectedException InvalidArgumentException
122
- * @expectedExceptionMessage $maxLength was not a positive integer value
123
121
* @covers ::filter
124
122
*/
125
123
public function filterMaxLengthNotInteger ()
126
124
{
125
+ $ this ->expectException (InvalidArgumentException::class);
126
+ $ this ->expectExceptionMessage ('$maxLength was not a positive integer value ' );
127
127
Strings::filter ('a ' , false , 1 , -1 );
128
128
}
129
129
130
130
/**
131
131
* @test
132
- * @expectedException InvalidArgumentException
133
- * @expectedExceptionMessage $minLength was not a positive integer value
134
132
* @covers ::filter
135
133
*/
136
134
public function filterMinLengthNegative ()
137
135
{
136
+ $ this ->expectException (InvalidArgumentException::class);
137
+ $ this ->expectExceptionMessage ('$minLength was not a positive integer value ' );
138
138
Strings::filter ('a ' , false , -1 );
139
139
}
140
140
141
141
/**
142
142
* @test
143
- * @expectedException InvalidArgumentException
144
- * @expectedExceptionMessage $maxLength was not a positive integer value
145
143
* @covers ::filter
146
144
*/
147
145
public function filterMaxLengthNegative ()
148
146
{
147
+ $ this ->expectException (InvalidArgumentException::class);
148
+ $ this ->expectExceptionMessage ('$maxLength was not a positive integer value ' );
149
149
Strings::filter ('a ' , false , 1 , -1 );
150
150
}
151
151
@@ -184,12 +184,11 @@ public function __toString()
184
184
/**
185
185
* @test
186
186
* @covers ::filter
187
- *
188
- * @expectedException \TraderInteractive\Exceptions\FilterException
189
- * @expectedExceptionMessage Value 'class@anonymous
190
187
*/
191
188
public function filterWithObjectNoToStringMethod ()
192
189
{
190
+ $ this ->expectException (\TraderInteractive \Exceptions \FilterException::class);
191
+ $ this ->expectExceptionMessage ("Value 'class@anonymous " );
193
192
$ testObject = new class () {
194
193
private $ data ;
195
194
@@ -215,11 +214,11 @@ public function translateValue()
215
214
/**
216
215
* @test
217
216
* @covers ::translate
218
- * @expectedException \TraderInteractive\Exceptions\FilterException
219
- * @expectedExceptionMessage The value 'baz' was not found in the translation map array.
220
217
*/
221
218
public function translateValueNotFoundInMap ()
222
219
{
220
+ $ this ->expectException (\TraderInteractive \Exceptions \FilterException::class);
221
+ $ this ->expectExceptionMessage ("The value 'baz' was not found in the translation map array. " );
223
222
$ map = ['foo ' => '100 ' , 'bar ' => '200 ' ];
224
223
Strings::translate ('baz ' , $ map );
225
224
}
@@ -248,25 +247,25 @@ public function explodeCustomDelimiter()
248
247
249
248
/**
250
249
* @test
251
- * @expectedException \TraderInteractive\Exceptions\FilterException
252
- * @expectedExceptionMessage Value '1234' is not a string
253
250
* @covers ::explode
254
251
*/
255
252
public function explodeNonString ()
256
253
{
254
+ $ this ->expectException (\TraderInteractive \Exceptions \FilterException::class);
255
+ $ this ->expectExceptionMessage ("Value '1234' is not a string " );
257
256
Strings::explode (1234 , '' );
258
257
}
259
258
260
259
/**
261
260
* Verifies explode filter with an empty delimiter.
262
261
*
263
262
* @test
264
- * @expectedException \InvalidArgumentException
265
- * @expectedExceptionMessage Delimiter '''' is not a non-empty string
266
263
* @covers ::explode
267
264
*/
268
265
public function explodeEmptyDelimiter ()
269
266
{
267
+ $ this ->expectException (\InvalidArgumentException::class);
268
+ $ this ->expectExceptionMessage ("Delimiter '''' is not a non-empty string " );
270
269
Strings::explode ('test ' , '' );
271
270
}
272
271
@@ -348,12 +347,12 @@ public function concat()
348
347
*
349
348
* @test
350
349
* @covers ::concat
351
- * @expectedException \TraderInteractive\Exceptions\FilterException
352
350
*
353
351
* @return void
354
352
*/
355
353
public function concatValueNotFilterable ()
356
354
{
355
+ $ this ->expectException (\TraderInteractive \Exceptions \FilterException::class);
357
356
Strings::concat (new \StdClass (), 'prefix ' , 'suffix ' );
358
357
}
359
358
0 commit comments