/** * Tests for strpos * * @param string $haystack String to search in * @param mixed $needle Characters to search * @param int $offset Start position * * @return void * @test * @dataProvider providerStrposException */ public function testStrposException($haystack, $needle, $offset = 0) { $native = null; $multibytes = null; $nativeException = false; $multibytesException = false; try { $native = $this->_native->strpos($haystack, $needle, $offset); } catch (PHPUnit_Framework_Error $e) { $nativeException = true; } try { $multibytes = $this->_mb->strpos($haystack, $needle, $offset); } catch (PHPUnit_Framework_Error $e) { $multibytesException = true; } $this->assertTrue(true === $nativeException && true === $multibytesException, 'native strpos: ' . var_export($native, true) . ' - mb strpos: ' . var_export($multibytes, true)); }
/** * Test for PMA_StringNative::strpos * * @param int $pos Expected position * @param string $haystack String to search in * @param string $needle String to search for * @param int $offset Search offset * * @return void * @test * @dataProvider strposData */ public function testStrpos($pos, $haystack, $needle, $offset) { $this->assertEquals($pos, $this->testObject->strpos($haystack, $needle, $offset)); }