return (int)$this->mDeleted;
}
- /**
- * Fetch revision text if it's available to the specified audience.
- * If the specified audience does not have the ability to view this
- * revision, an empty string will be returned.
- *
- * @param int $audience One of:
- * Revision::FOR_PUBLIC to be displayed to all users
- * Revision::FOR_THIS_USER to be displayed to the given user
- * Revision::RAW get the text regardless of permissions
- * @param User $user User object to check for, only if FOR_THIS_USER is passed
- * to the $audience parameter
- *
- * @deprecated since 1.21, use getContent() instead
- * @return string
- */
- public function getText( $audience = self::FOR_PUBLIC, User $user = null ) {
- wfDeprecated( __METHOD__, '1.21' );
-
- $content = $this->getContent( $audience, $user );
- return ContentHandler::getContentText( $content ); # returns the raw content text, if applicable
- }
-
/**
* Fetch revision content if it's available to the specified audience.
* If the specified audience does not have the ability to view this
);
}
- function dataGetText() {
- // NOTE: we expect the help namespace to always contain wikitext
- return [
- [ 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ],
- [ serialize( 'hello world' ), 'Hello', "testing", null, Revision::FOR_PUBLIC, null ],
- [ serialize( 'hello world' ), 'Dummy:Hello', null, null, Revision::FOR_PUBLIC, null ],
- ];
- }
-
- /**
- * @group Database
- * @dataProvider dataGetText
- * @covers Revision::getText
- */
- public function testGetText( $text, $title, $model, $format, $audience, $expectedText ) {
- $this->hideDeprecated( 'Revision::getText' );
-
- $rev = $this->newTestRevision( $text, $title, $model, $format );
-
- $this->assertEquals( $expectedText, $rev->getText( $audience ) );
- }
-
public function dataGetSize() {
return [
[ "hello world.", CONTENT_MODEL_WIKITEXT, 12 ],
* @covers Revision::__construct
*/
public function testConstructWithText() {
- $this->hideDeprecated( "Revision::getText" );
-
$rev = new Revision( [
'text' => 'hello world.',
'content_model' => CONTENT_MODEL_JAVASCRIPT
] );
- $this->assertNotNull( $rev->getText(), 'no content text' );
$this->assertNotNull( $rev->getContent(), 'no content object available' );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContent()->getModel() );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() );
* @covers Revision::__construct
*/
public function testConstructWithContent() {
- $this->hideDeprecated( "Revision::getText" );
-
$title = Title::newFromText( 'RevisionTest_testConstructWithContent' );
$rev = new Revision( [
'content' => ContentHandler::makeContent( 'hello world.', $title, CONTENT_MODEL_JAVASCRIPT ),
] );
- $this->assertNotNull( $rev->getText(), 'no content text' );
$this->assertNotNull( $rev->getContent(), 'no content object available' );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContent()->getModel() );
$this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() );