38 $this->assertTrue( $record->hasAddress() );
39 $this->assertTrue( $record->hasRevision() );
40 $this->assertTrue( $record->isInherited() );
41 $this->assertSame(
'A', $record->getContent()->getNativeData() );
42 $this->assertSame( 5, $record->getSize() );
43 $this->assertSame(
'someHash', $record->getSha1() );
45 $this->assertSame( 2, $record->getRevision() );
46 $this->assertSame( 1, $record->getOrigin() );
47 $this->assertSame(
'tt:456', $record->getAddress() );
48 $this->assertSame( 33, $record->getContentId() );
50 $this->assertSame(
'myRole', $record->getRole() );
55 'content_size' =>
null,
56 'content_sha1' =>
null,
57 'format_name' =>
function () {
60 'slot_revision_id' =>
'2',
64 $content =
function () {
70 $this->assertTrue( $record->hasAddress() );
71 $this->assertTrue( $record->hasRevision() );
72 $this->assertFalse( $record->isInherited() );
73 $this->assertSame(
'A', $record->getContent()->getNativeData() );
74 $this->assertSame( 1, $record->getSize() );
75 $this->assertNotNull( $record->getSha1() );
77 $this->assertSame( 2, $record->getRevision() );
78 $this->assertSame( 2, $record->getRevision() );
79 $this->assertSame(
'tt:456', $record->getAddress() );
80 $this->assertSame( 33, $record->getContentId() );
82 $this->assertSame(
'myRole', $record->getRole() );
86 $record = SlotRecord::newUnsaved(
'myRole',
new WikitextContent(
'A' ) );
88 $this->assertFalse( $record->hasAddress() );
89 $this->assertFalse( $record->hasRevision() );
90 $this->assertFalse( $record->isInherited() );
91 $this->assertSame(
'A', $record->getContent()->getNativeData() );
92 $this->assertSame( 1, $record->getSize() );
93 $this->assertNotNull( $record->getSha1() );
95 $this->assertSame(
'myRole', $record->getRole() );
183 $row = $this->
makeRow( [
'slot_revision_id' => 7,
'slot_origin' => 7 ] );
187 $inherited = SlotRecord::newInherited( $parent );
189 $this->assertSame( $parent->getContentId(), $inherited->getContentId() );
190 $this->assertSame( $parent->getAddress(), $inherited->getAddress() );
191 $this->assertSame( $parent->getContent(), $inherited->getContent() );
192 $this->assertTrue( $inherited->isInherited() );
193 $this->assertFalse( $inherited->hasRevision() );
196 $this->assertFalse( $parent->isInherited() );
197 $this->assertSame( 7, $parent->getRevision() );
201 $saved = SlotRecord::newSaved(
203 $inherited->getContentId(),
204 $inherited->getAddress(),
207 $this->assertSame( $parent->getContentId(), $saved->getContentId() );
208 $this->assertSame( $parent->getAddress(), $saved->getAddress() );
209 $this->assertSame( $parent->getContent(), $saved->getContent() );
210 $this->assertTrue( $saved->isInherited() );
211 $this->assertTrue( $saved->hasRevision() );
212 $this->assertSame( 10, $saved->getRevision() );
215 $this->assertSame( 7, $parent->getRevision() );
216 $this->assertFalse( $inherited->hasRevision() );
221 $unsaved = SlotRecord::newUnsaved(
'main',
new WikitextContent(
'A' ) );
225 $saved = SlotRecord::newSaved( 10, 20,
'theNewAddress', $unsaved );
226 $this->assertFalse( $saved->isInherited() );
227 $this->assertTrue( $saved->hasRevision() );
228 $this->assertTrue( $saved->hasAddress() );
229 $this->assertSame(
'theNewAddress', $saved->getAddress() );
230 $this->assertSame( 20, $saved->getContentId() );
231 $this->assertSame(
'A', $saved->getContent()->getNativeData() );
232 $this->assertSame( 10, $saved->getRevision() );
233 $this->assertSame( 10, $saved->getOrigin() );
236 $this->assertFalse( $unsaved->hasAddress() );
237 $this->assertFalse( $unsaved->hasRevision() );