/tests/cases/Utf8StristrTest.php
PHP | 56 lines | 47 code | 9 blank | 0 comment | 0 complexity | 1750d5750945563b8ec4d09800ee2ee7 MD5 | raw file
Possible License(s): LGPL-2.1
- <?php
- require_once PHP_UTF8_DIR.'/functions/stristr.php';
- class Utf8StristrTest extends PHPUnit_Framework_TestCase
- {
- public function test_substr()
- {
- $str = 'ińtërnâtiônŕlizćtiřn';
- $search = 'NÂT';
- $this->assertEquals('nâtiônŕlizćtiřn', utf8\ifind($str, $search));
- }
- public function test_substr_no_match()
- {
- $str = 'ińtërnâtiônŕlizćtiřn';
- $search = 'foo';
- $this->assertFalse(utf8\ifind($str, $search));
- }
- public function test_empty_search()
- {
- $str = 'ińtërnâtiônŕlizćtiřn';
- $search = '';
- $this->assertEquals('ińtërnâtiônŕlizćtiřn', utf8\ifind($str, $search));
- }
- public function test_empty_str()
- {
- $str = '';
- $search = 'NÂT';
- $this->assertFalse(utf8\ifind($str, $search));
- }
- public function test_empty_both()
- {
- $str = '';
- $search = '';
- $this->assertEmpty(utf8\ifind($str, $search));
- }
- public function test_linefeed_str()
- {
- $str = "ińt\nërnâtiônŕlizćtiřn";
- $search = 'NÂT';
- $this->assertEquals('nâtiônŕlizćtiřn', utf8\ifind($str, $search));
- }
- public function test_linefeed_both()
- {
- $str = "ińtërn\nâtiônŕlizćtiřn";
- $search = "N\nÂT";
- $this->assertEquals("n\nâtiônŕlizćtiřn", utf8\ifind($str, $search));
- }
- }