Index: trunk/phase3/maintenance/tests/phpunit/includes/SampleTest.php |
— | — | @@ -41,12 +41,37 @@ |
42 | 42 | /** |
43 | 43 | * @dataProvider provideTitles() |
44 | 44 | */ |
45 | | - public function testCreation($titleName, $ns, $text) { |
| 45 | + public function testTitleCreation($titleName, $ns, $text) { |
46 | 46 | $title = Title::newFromText($titleName, $ns); |
47 | 47 | $this->assertEquals($text, "$title", "see if '$titleName' matches '$text'"); |
48 | 48 | } |
49 | 49 | |
| 50 | + public function testInitialCreation() { |
| 51 | + $title = Title::newMainPage(); |
| 52 | + $this->assertEquals("Main Page", "$title", "Test initial creation of a title"); |
| 53 | + |
| 54 | + return $title; |
| 55 | + } |
| 56 | + |
50 | 57 | /** |
| 58 | + * Instead of putting a bunch of tests in a single test method, |
| 59 | + * you should put only one or two tests in each test method. This |
| 60 | + * way, the test method names can remain descriptive. |
| 61 | + * |
| 62 | + * If you want to make tests depend on data created in another |
| 63 | + * method, you can create dependencies feed whatever you return |
| 64 | + * from the dependant method (e.g. testInitialCreation in this |
| 65 | + * example) as arguments to the next method (e.g. $title in |
| 66 | + * testTitleDepends is whatever testInitialCreatiion returned.) |
| 67 | + */ |
| 68 | + /** |
| 69 | + * @depends testInitialCreation |
| 70 | + */ |
| 71 | + public function testTitleDepends( $title ) { |
| 72 | + $this->assertTrue( $title->isLocal() ); |
| 73 | + } |
| 74 | + |
| 75 | + /** |
51 | 76 | * @expectedException MWException object |
52 | 77 | * |
53 | 78 | * Above comment tells PHPUnit to expect an exception of the |