]> projects.mako.cc - scuttle/blob - includes/utf8/tests/cases/utf8_stristr.test.php
- Override privacy status on bookmark file import, if specified (i.e. Delicious)
[scuttle] / includes / utf8 / tests / cases / utf8_stristr.test.php
1 <?php
2 /**
3 * @version $Id: utf8_stristr.test.php,v 1.2 2006/02/25 14:52:18 harryf Exp $
4 * @package utf8
5 * @subpackage Tests
6 */
7
8 //--------------------------------------------------------------------
9 /**
10 * Includes
11 * @package utf8
12 * @subpackage Tests
13 */
14 require_once(dirname(__FILE__).'/../config.php');
15 require_once UTF8 . '/stristr.php';
16
17 //--------------------------------------------------------------------
18 /**
19 * @package utf8
20 * @subpackage Tests
21 */
22 class test_utf8_stristr extends UnitTestCase {
23
24     function test_utf8_stristr () {
25         $this->UnitTestCase('test_utf8_stristr()');
26     }
27     
28     function testSubstr() {
29         $str = 'iñtërnâtiônàlizætiøn';
30         $search = 'NÂT';
31         $this->assertEqual(utf8_stristr($str,$search),'nâtiônàlizætiøn');
32     }
33     
34     function testSubstrNoMatch() {
35         $str = 'iñtërnâtiônàlizætiøn';
36         $search = 'foo';
37         $this->assertFalse(utf8_stristr($str,$search));
38     }
39     
40     function testEmptySearch() {
41         $str = 'iñtërnâtiônàlizætiøn';
42         $search = '';
43         $this->assertEqual(utf8_stristr($str,$search),'iñtërnâtiônàlizætiøn');
44     }
45     
46     function testEmptyStr() {
47         $str = '';
48         $search = 'NÂT';
49         $this->assertFalse(utf8_stristr($str,$search));
50     }
51     
52     function testEmptyBoth() {
53         $str = '';
54         $search = '';
55         $this->assertEqual(utf8_stristr($str,$search),'');
56     }
57     
58     function testLinefeedStr() {
59         $str = "iñt\nërnâtiônàlizætiøn";
60         $search = 'NÂT';
61         $this->assertEqual(utf8_stristr($str,$search),'nâtiônàlizætiøn');
62     }
63     
64     function testLinefeedBoth() {
65         $str = "iñtërn\nâtiônàlizætiøn";
66         $search = "N\nÂT";
67         $this->assertEqual(utf8_stristr($str,$search),"n\nâtiônàlizætiøn");
68     }
69 }
70
71 //--------------------------------------------------------------------
72 /**
73 * @package utf8
74 * @subpackage Tests
75 */
76 if (!defined('TEST_RUNNING')) {
77     define('TEST_RUNNING', true);
78     $test = &new test_utf8_stristr ();
79     $reporter = & getTestReporter();
80     $test->run($reporter);
81 }

Benjamin Mako Hill || Want to submit a patch?