1111
1212namespace Symfony \Bridge \PhpUnit \Legacy ;
1313
14+ use PHPUnit \Framework \Constraint \StringContains ;
1415use PHPUnit \Framework \MockObject \MockObject ;
1516use PHPUnit \Framework \TestCase ;
1617
@@ -51,33 +52,21 @@ protected function tearDown()
5152self ::doTearDown ();
5253 }
5354
54- /**
55- * @return void
56- */
5755private static function doSetUpBeforeClass ()
5856 {
5957parent ::setUpBeforeClass ();
6058 }
6159
62- /**
63- * @return void
64- */
6560private static function doTearDownAfterClass ()
6661 {
6762parent ::tearDownAfterClass ();
6863 }
6964
70- /**
71- * @return void
72- */
7365private function doSetUp ()
7466 {
7567parent ::setUp ();
7668 }
7769
78- /**
79- * @return void
80- */
8170private function doTearDown ()
8271 {
8372parent ::tearDown ();
@@ -233,6 +222,32 @@ public static function assertIsIterable($actual, $message = '')
233222static ::assertInternalType ('iterable ' ,$ actual ,$ message );
234223 }
235224
225+ /**
226+ * @param string $needle
227+ * @param string $haystack
228+ * @param string $message
229+ *
230+ * @return void
231+ */
232+ public static function assertStringContainsString ($ needle ,$ haystack ,$ message ='' )
233+ {
234+ $ constraint =new StringContains ($ needle ,false );
235+ static ::assertThat ($ haystack ,$ constraint ,$ message );
236+ }
237+
238+ /**
239+ * @param string $needle
240+ * @param string $haystack
241+ * @param string $message
242+ *
243+ * @return void
244+ */
245+ public static function assertStringContainsStringIgnoringCase ($ needle ,$ haystack ,$ message ='' )
246+ {
247+ $ constraint =new StringContains ($ needle ,true );
248+ static ::assertThat ($ haystack ,$ constraint ,$ message );
249+ }
250+
236251/**
237252 * @param string $message
238253 *
@@ -303,6 +318,8 @@ public function expectException($exception)
303318 }
304319
305320/**
321+ * @param int|string $code
322+ *
306323 * @return void
307324 */
308325public function expectExceptionCode ($ code )
@@ -315,7 +332,7 @@ public function expectExceptionCode($code)
315332
316333$ property =new \ReflectionProperty (class_exists ('PHPUnit_Framework_TestCase ' ) ?'PHPUnit_Framework_TestCase ' : TestCase::class,'expectedExceptionCode ' );
317334$ property ->setAccessible (true );
318- $ property ->setValue ($ this ,$ exception );
335+ $ property ->setValue ($ this ,$ code );
319336 }
320337
321338/**
@@ -333,7 +350,7 @@ public function expectExceptionMessage($message)
333350
334351$ property =new \ReflectionProperty (class_exists ('PHPUnit_Framework_TestCase ' ) ?'PHPUnit_Framework_TestCase ' : TestCase::class,'expectedExceptionMessage ' );
335352$ property ->setAccessible (true );
336- $ property ->setValue ($ this ,$ exception );
353+ $ property ->setValue ($ this ,$ message );
337354 }
338355
339356/**
@@ -351,6 +368,6 @@ public function expectExceptionMessageRegExp($messageRegExp)
351368
352369$ property =new \ReflectionProperty (class_exists ('PHPUnit_Framework_TestCase ' ) ?'PHPUnit_Framework_TestCase ' : TestCase::class,'expectedExceptionMessageRegExp ' );
353370$ property ->setAccessible (true );
354- $ property ->setValue ($ this ,$ exception );
371+ $ property ->setValue ($ this ,$ messageRegExp );
355372 }
356373}