Tagged 0.7.5
[scuttle] / includes / utf8 / tests / cases / utf8_ucwords.test.php
1 <?php
2 /**
3 * @version $Id: utf8_ucwords.test.php,v 1.3 2006/02/26 13:07:42 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 . '/ucwords.php';
16
17 //--------------------------------------------------------------------
18 /**
19 * @package utf8
20 * @subpackage Tests
21 */
22 class test_utf8_ucwords extends UnitTestCase {
23
24     function test_utf8_ucwords () {
25         $this->UnitTestCase('test_utf8_ucwords ()');
26     }
27     
28     function testUcword() {
29         $str = 'iñtërnâtiônàlizætiøn';
30         $ucwords = 'Iñtërnâtiônàlizætiøn';
31         $this->assertEqual(utf8_ucwords($str),$ucwords);
32     }
33     
34     function testUcwords() {
35         $str = 'iñt ërn âti ônà liz æti øn';
36         $ucwords = 'Iñt Ërn Âti Ônà Liz Æti Øn';
37         $this->assertEqual(utf8_ucwords($str),$ucwords);
38     }
39     
40     function testUcwordsNewline() {
41         $str = "iñt ërn âti\n ônà liz æti  øn";
42         $ucwords = "Iñt Ërn Âti\n Ônà Liz Æti  Øn";
43         $this->assertEqual(utf8_ucwords($str),$ucwords);
44     }
45     
46     function testEmptyString() {
47         $str = '';
48         $ucwords = '';
49         $this->assertEqual(utf8_ucwords($str),$ucwords);
50     }
51     
52     function testOneChar() {
53         $str = 'ñ';
54         $ucwords = 'Ñ';
55         $this->assertEqual(utf8_ucwords($str),$ucwords);
56     }
57     
58     function testLinefeed() {
59         $str = "iñt ërn âti\n ônà liz æti øn";
60         $ucwords = "Iñt Ërn Âti\n Ônà Liz Æti Øn";
61         $this->assertEqual(utf8_ucwords($str),$ucwords);
62     }
63     
64 }
65
66 //--------------------------------------------------------------------
67 /**
68 * @package utf8
69 * @subpackage Tests
70 */
71 if (!defined('TEST_RUNNING')) {
72     define('TEST_RUNNING', true);
73     $test = &new test_utf8_ucwords ();
74     $reporter = & getTestReporter();
75     $test->run($reporter);
76 }

Benjamin Mako Hill || Want to submit a patch?