| Index: trunk/phase3/maintenance/tests/phpunit/includes/SampleTest.php |
| — | — | @@ -14,7 +14,14 @@ |
| 15 | 15 | function tearDown() { |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | | - function testEqual() { |
| | 18 | + /** |
| | 19 | + * Name tests so that PHPUnit can turn them into sentances when |
| | 20 | + * they run. While MediaWiki isn't strictly an Agile Programming |
| | 21 | + * project, you are encouraged to use the naming described under |
| | 22 | + * "Agile Documentation" at |
| | 23 | + * http://www.phpunit.de/manual/3.4/en/other-uses-for-tests.html |
| | 24 | + */ |
| | 25 | + function testTitleObjectStringConversion() { |
| 19 | 26 | $title = Title::newFromText("text"); |
| 20 | 27 | $this->assertEquals("Text", $title->__toString(), "Title creation"); |
| 21 | 28 | $this->assertEquals("Text", "Text", "Automatic string conversion"); |
| — | — | @@ -39,15 +46,15 @@ |
| 40 | 47 | } |
| 41 | 48 | |
| 42 | 49 | /** |
| 43 | | - * @dataProvider provideTitles() |
| | 50 | + * @dataProvider provideTitles |
| 44 | 51 | * See http://www.phpunit.de/manual/3.4/en/appendixes.annotations.html#appendixes.annotations.dataProvider |
| 45 | 52 | */ |
| 46 | | - public function testTitleCreation($titleName, $ns, $text) { |
| | 53 | + public function testCreateBasicListOfTitles($titleName, $ns, $text) { |
| 47 | 54 | $title = Title::newFromText($titleName, $ns); |
| 48 | 55 | $this->assertEquals($text, "$title", "see if '$titleName' matches '$text'"); |
| 49 | 56 | } |
| 50 | 57 | |
| 51 | | - public function testInitialCreation() { |
| | 58 | + public function testSetUpMainPageTitleForNextTest() { |
| 52 | 59 | $title = Title::newMainPage(); |
| 53 | 60 | $this->assertEquals("Main Page", "$title", "Test initial creation of a title"); |
| 54 | 61 | |
| — | — | @@ -66,23 +73,20 @@ |
| 67 | 74 | * testTitleDepends is whatever testInitialCreatiion returned.) |
| 68 | 75 | */ |
| 69 | 76 | /** |
| 70 | | - * @depends testInitialCreation |
| | 77 | + * @depends testSetUpMainPageTitleForNextTest |
| 71 | 78 | * See http://www.phpunit.de/manual/3.4/en/appendixes.annotations.html#appendixes.annotations.depends |
| 72 | 79 | */ |
| 73 | | - public function testTitleDepends( $title ) { |
| | 80 | + public function testCheckMainPageTitleIsConsideredLocal( $title ) { |
| 74 | 81 | $this->assertTrue( $title->isLocal() ); |
| 75 | 82 | } |
| 76 | 83 | |
| 77 | 84 | /** |
| 78 | | - * If the code you're testing can produce Exceptions, you can also |
| 79 | | - * test for them. In the following example, the test expects a |
| 80 | | - * MWException containing the string "object" in the message.. |
| 81 | | - */ |
| 82 | | - /** |
| 83 | 85 | * @expectedException MWException object |
| 84 | 86 | * See http://www.phpunit.de/manual/3.4/en/appendixes.annotations.html#appendixes.annotations.expectedException |
| 85 | 87 | */ |
| 86 | | - function testException() { |
| | 88 | + function testTitleObjectFromObject() { |
| 87 | 89 | $title = Title::newFromText(new Title("test")); |
| | 90 | + $this->assertEquals( "Test", $title->isLocal() ); |
| 88 | 91 | } |
| 89 | | -} |
| | 92 | + } |
| | 93 | + |