Merge "Improve documentation for "pipe trick""
[lhc/web/wiklou.git] / tests / phpunit / includes / RequestContextTest.php
1 <?php
2
3 class RequestContextTest extends MediaWikiTestCase {
4
5 /**
6 * Test the relationship between title and wikipage in RequestContext
7 */
8 public function testWikiPageTitle() {
9 $context = new RequestContext();
10
11 $curTitle = Title::newFromText( "A" );
12 $context->setTitle( $curTitle );
13 $this->assertTrue( $curTitle->equals( $context->getWikiPage()->getTitle() ),
14 "When a title is first set WikiPage should be created on-demand for that title." );
15
16 $curTitle = Title::newFromText( "B" );
17 $context->setWikiPage( WikiPage::factory( $curTitle ) );
18 $this->assertTrue( $curTitle->equals( $context->getTitle() ),
19 "Title must be updated when a new WikiPage is provided." );
20
21 $curTitle = Title::newFromText( "C" );
22 $context->setTitle( $curTitle );
23 $this->assertTrue( $curTitle->equals( $context->getWikiPage()->getTitle() ),
24 "When a title is updated the WikiPage should be purged and recreated on-demand with the new title." );
25
26 }
27
28 }