25 $mainSlot = SlotRecord::newUnsaved(
'main',
new WikitextContent(
'A' ) );
29 $this->assertSame( $mainSlot, $slots->getSlot(
'main' ) );
30 $this->assertSame( $auxSlot, $slots->getSlot(
'aux' ) );
31 $this->setExpectedException( RevisionAccessException::class );
32 $slots->getSlot(
'nothere' );
39 $mainSlot = SlotRecord::newUnsaved(
'main',
new WikitextContent(
'A' ) );
43 $this->assertTrue( $slots->hasSlot(
'main' ) );
44 $this->assertTrue( $slots->hasSlot(
'aux' ) );
45 $this->assertFalse( $slots->hasSlot(
'AUX' ) );
46 $this->assertFalse( $slots->hasSlot(
'xyz' ) );
55 $mainSlot = SlotRecord::newUnsaved(
'main', $mainContent );
56 $auxSlot = SlotRecord::newUnsaved(
'aux', $auxContent );
59 $this->assertSame( $mainContent, $slots->getContent(
'main' ) );
60 $this->assertSame( $auxContent, $slots->getContent(
'aux' ) );
61 $this->setExpectedException( RevisionAccessException::class );
62 $slots->getContent(
'nothere' );
69 $mainSlot = SlotRecord::newUnsaved(
'main',
new WikitextContent(
'A' ) );
73 $this->assertSame( [
'main',
'aux' ], $slots->getSlotRoles() );
82 $this->assertSame( [], $slots->getSlotRoles() );
89 $mainSlot = SlotRecord::newUnsaved(
'main',
new WikitextContent(
'A' ) );
91 $slotsArray = [ $mainSlot, $auxSlot ];
94 $this->assertEquals( [
'main' => $mainSlot,
'aux' => $auxSlot ], $slots->getSlots() );
99 yield [ 2, [
'AA' ] ];
100 yield [ 4, [
'AA',
'X',
'H' ] ];
109 foreach ( $contentStrings as $key => $contentString ) {
110 $slotsArray[] = SlotRecord::newUnsaved( strval( $key ),
new WikitextContent( $contentString ) );
114 $this->assertSame( $expected, $slots->computeSize() );
118 yield [
'ctqm7794fr2dp1taki8a88ovwnvmnmj', [
'A' ] ];
119 yield [
'eyq8wiwlcofnaiy4eid97gyfy60uw51', [
'AA' ] ];
120 yield [
'lavctqfpxartyjr31f853drgfl4kj1g', [
'AA',
'X',
'H' ] ];
131 foreach ( $contentStrings as $key => $contentString ) {
132 $slotsArray[] = SlotRecord::newUnsaved( strval( $key ),
new WikitextContent( $contentString ) );
136 $this->assertSame( $expected, $slots->computeSha1() );
Content object for wiki text pages.