/** * Tests for substr_count * * @param string $haystack String to look into * @param int $needle String to look for * * @return void * @test * @dataProvider providerSubstrCountException */ public function testSubstrCountException($haystack, $needle) { $native = null; $multibytes = null; $nativeException = false; $multibytesException = false; try { $native = $this->_native->substrCount($haystack, $needle); } catch (PHPUnit_Framework_Error $e) { $nativeException = true; } try { $multibytes = $this->_mb->substrCount($haystack, $needle); } catch (PHPUnit_Framework_Error $e) { $multibytesException = true; } $this->assertTrue(true === $nativeException && true === $multibytesException, 'native substrCount: ' . var_export($native, true) . ' - mb substrCount: ' . var_export($multibytes, true)); }
/** * Test for PMA_StringNative::substrCount * * @param string $haystack string to check * @param string $needle string to count * * @return void * @test * @dataProvider substrCountDataException * * @expectedException PHPUnit_Framework_Error */ public function testSubstrCountException($haystack, $needle) { $this->testObject->substrCount($haystack, $needle); }