adding some strings
[moodle-linuxchix.git] / lib / simpletest / testweblib.php
blob68e6d6b22f9913fe0bd3061182c58ef56611575e
1 <?php
2 /**
3 * Unit tests for (some of) ../weblib.php.
5 * @copyright &copy; 2006 The Open University
6 * @author T.J.Hunt@open.ac.uk
7 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
8 * @package moodlecore
9 */
11 if (!defined('MOODLE_INTERNAL')) {
12 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
15 class web_test extends UnitTestCase {
17 function setUp() {
20 function tearDown() {
23 function test_format_string() {
24 // Ampersands
25 $this->assertEqual(format_string("& &&&&& &&"), "&amp; &amp;&amp;&amp;&amp;&amp; &amp;&amp;");
26 $this->assertEqual(format_string("ANother & &&&&& Category"), "ANother &amp; &amp;&amp;&amp;&amp;&amp; Category");
27 $this->assertEqual(format_string("ANother & &&&&& Category", true), "ANother &amp; &amp;&amp;&amp;&amp;&amp; Category");
28 $this->assertEqual(format_string("Nick's Test Site & Other things", true), "Nick's Test Site &amp; Other things");
30 // String entities
31 $this->assertEqual(format_string("&quot;"), "&quot;");
33 // Digital entities
34 $this->assertEqual(format_string("&11234;"), "&11234;");
36 // Unicode entities
37 $this->assertEqual(format_string("&#4475;"), "&#4475;");
40 function test_s() {
41 $this->assertEqual(s("This Breaks \" Strict"), "This Breaks &quot; Strict");