2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
16 * Tests utility functions for the infusion builder.
18 require_once ('../classes/ContentOutputUtils.class.php');
20 class TestContentOutputUtils extends UnitTestCase
23 private $testString = "<p>This is some text.</p>
29 private $expectedResult = "<p>This is some text.</p>
30 <p>[code]alert('1');alert('2');[/code]</p>";
33 * Tests testStripPTags
35 function testStripPTags1()
37 $utils = new ContentOutputUtils();
38 $actualResult = $utils->stripPtags($this->testString);
39 $actualLength = strlen($actualResult);
40 $expectedLength = strlen($this->expectedResult);
41 $this->assertEqual($expectedLength, $actualLength);
42 $maxLength = max($expectedLength, $actualLength);
43 for ($i = 0; $i < $maxLength; $i++) {
44 $this->assertEqual($this->expectedResult[$i], $actualResult[$i], "i is ". $i." chars are ".$this->expectedResult[$i]." and ".$actualResult[$i]);
46 $this->assertEqual($this->expectedResult, $actualResult);