Initial checkin from !mwhack of a sample PHPUnit check.
authorMark A. Hershberger <mah@users.mediawiki.org>
Sat, 23 Oct 2010 15:06:06 +0000 (15:06 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Sat, 23 Oct 2010 15:06:06 +0000 (15:06 +0000)
maintenance/tests/phpunit/includes/SampleTest.php [new file with mode: 0644]

diff --git a/maintenance/tests/phpunit/includes/SampleTest.php b/maintenance/tests/phpunit/includes/SampleTest.php
new file mode 100644 (file)
index 0000000..905ff79
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+class TestSample extends PHPUnit_Framework_TestCase {
+
+       function setUp() {
+       }
+
+       function testEqual() {
+               $title = Title::newFromText("text");
+               $this->assertEquals("Text", $title->__toString(), "Title creation");
+               $this->assertEquals("Text", "Text", "Automatic string conversion");
+
+               $title = Title::newFromText("text", NS_MEDIA);
+               $this->assertEquals("Media:Text", $title->__toString(), "Title creation with namespace");
+
+       }
+
+       /**
+        * @expectedException MWException object
+        *
+        * Above comment tells PHPUnit to expect an exception of the
+        * MWException class containing the string "object" in the
+        * message.
+        */
+       function testException() {
+               $title = Title::newFromText(new Title("test"));
+       }
+}