use MediaWiki\Revision\IncompleteRevisionException;
use MediaWiki\Revision\SlotRecord;
use MediaWiki\Revision\SuppressedDataException;
+use MediaWikiUnitTestCase;
use WikitextContent;
/**
* @covers \MediaWiki\Revision\SlotRecord
*/
-class SlotRecordTest extends \MediaWikiUnitTestCase {
+class SlotRecordTest extends MediaWikiUnitTestCase {
private function makeRow( $data = [] ) {
$data = $data + [
$this->assertFalse( $record->isInherited() );
$this->assertSame( 'A', $record->getContent()->getText() );
$this->assertSame( 1, $record->getSize() );
- $this->assertNotNull( $record->getSha1() );
+ $this->assertNotEmpty( $record->getSha1() );
$this->assertSame( CONTENT_MODEL_WIKITEXT, $record->getModel() );
$this->assertSame( 2, $record->getRevision() );
$this->assertSame( 2, $record->getRevision() );
$this->assertFalse( $record->hasOrigin() );
$this->assertSame( 'A', $record->getContent()->getText() );
$this->assertSame( 1, $record->getSize() );
- $this->assertNotNull( $record->getSha1() );
+ $this->assertNotEmpty( $record->getSha1() );
$this->assertSame( CONTENT_MODEL_WIKITEXT, $record->getModel() );
$this->assertSame( 'myRole', $record->getRole() );
}
$this->assertSame( $hash, $record->getSha1() );
}
+ public function testHashComputed() {
+ $row = $this->makeRow();
+ $row->content_sha1 = '';
+
+ $rec = new SlotRecord( $row, new WikitextContent( 'A' ) );
+ $this->assertNotEmpty( $rec->getSha1() );
+ }
+
public function testNewWithSuppressedContent() {
$input = new SlotRecord( $this->makeRow(), new WikitextContent( 'A' ) );
$output = SlotRecord::newWithSuppressedContent( $input );