6use InvalidArgumentException;
39 $title = Title::newFromText(
'Dummy' );
40 $title->resetArticleID( 17 );
43 $comment = CommentStoreComment::newUnsavedComment(
'Hello World' );
47 if (
isset( $rowOverrides[
'rev_deleted'] ) ) {
48 $record->setVisibility( $rowOverrides[
'rev_deleted'] );
51 if (
isset( $rowOverrides[
'rev_id'] ) ) {
52 $record->setId( $rowOverrides[
'rev_id'] );
55 if (
isset( $rowOverrides[
'rev_page'] ) ) {
56 $record->setPageId( $rowOverrides[
'rev_page'] );
59 $record->setContent( SlotRecord::MAIN,
new TextContent(
'Lorem Ipsum' ) );
60 $record->setComment( $comment );
61 $record->setUser( $user );
62 $record->setTimestamp(
'20101010000000' );
68 $title = Title::newFromText(
'Dummy' );
69 $title->resetArticleID( 17 );
89 $this->
assertSame( $title, $rec->getPageAsLinkTarget(),
'getPageAsLinkTarget' );
90 $this->
assertSame( $wikiId, $rec->getWikiId(),
'getWikiId' );
94 $title = Title::newFromText(
'Dummy' );
95 $title->resetArticleID( 17 );
97 yield
'not a wiki id' => [
120 $record->setId( 888 );
128 $record->setUser( $user );
129 $this->
assertSame( $user, $record->getUser() );
135 $record->setPageId( 999 );
136 $this->
assertSame( 999, $record->getPageId() );
142 $record->setParentId( 100 );
143 $this->
assertSame( 100, $record->getParentId() );
149 $this->
assertNull( $record->getContent( SlotRecord::MAIN ) );
155 $record->setContent( SlotRecord::MAIN,
$content );
161 $this->
assertFalse( $record->hasSlot( SlotRecord::MAIN ) );
164 $record->getSlot( SlotRecord::MAIN );
169 $slot = SlotRecord::newUnsaved(
173 $record->setSlot( $slot );
174 $this->
assertTrue( $record->hasSlot( SlotRecord::MAIN ) );
175 $this->
assertSame( $slot, $record->getSlot( SlotRecord::MAIN ) );
181 $record->setMinorEdit(
true );
182 $this->
assertSame(
true, $record->isMinor() );
188 $record->setTimestamp(
'20180101010101' );
189 $this->
assertSame(
'20180101010101', $record->getTimestamp() );
194 $this->
assertSame( 0, $record->getVisibility() );
195 $record->setVisibility( RevisionRecord::DELETED_USER );
196 $this->
assertSame( RevisionRecord::DELETED_USER, $record->getVisibility() );
201 $this->
assertSame(
'phoiac9h4m842xq45sp7s6u21eteeq1', $record->getSha1() );
202 $record->setSha1(
'someHash' );
203 $this->
assertSame(
'someHash', $record->getSha1() );
208 $this->
assertInstanceOf( MutableRevisionSlots::class, $record->getSlots() );
214 $record->setSize( 775 );
222 $record->setComment( $comment );
223 $this->
assertSame( $comment, $record->getComment() );
231 'slot_revision_id' =>
null,
232 'slot_content_id' => 1,
233 'content_address' =>
null,
235 'role_name' =>
'main',
236 'slot_origin' =>
null
243 'slot_revision_id' =>
null,
244 'slot_content_id' => 1,
245 'content_address' =>
'foo',
247 'role_name' =>
'aux',
253 $record->setSlot( $mainSlot );
254 $record->setSlot( $auxSlot );
256 $this->
assertSame( [
'main' ], $record->getOriginalSlots()->getSlotRoles() );
257 $this->
assertSame( $mainSlot, $record->getOriginalSlots()->getSlot( SlotRecord::MAIN ) );
259 $this->
assertSame( [
'aux' ], $record->getInheritedSlots()->getSlotRoles() );
260 $this->
assertSame( $auxSlot, $record->getInheritedSlots()->getSlot(
'aux' ) );
269 $record->inheritSlot( SlotRecord::newSaved( 7, 3,
'a', SlotRecord::newUnsaved(
'a', $a ) ) );
270 $record->inheritSlot( SlotRecord::newSaved( 7, 4,
'b', SlotRecord::newUnsaved(
'b', $b ) ) );
272 $record->removeSlot(
'b' );
286 $update->modifyContent(
'b', $x );
287 $update->modifyContent(
'c', $x );
288 $update->removeSlot(
'c' );
289 $update->removeSlot(
'd' );
292 $record->inheritSlot( SlotRecord::newSaved( 7, 3,
'a', SlotRecord::newUnsaved(
'a', $a ) ) );
293 $record->inheritSlot( SlotRecord::newSaved( 7, 4,
'b', SlotRecord::newUnsaved(
'b', $b ) ) );
294 $record->inheritSlot( SlotRecord::newSaved( 7, 5,
'c', SlotRecord::newUnsaved(
'c', $c ) ) );
296 $record->applyUpdate( $update );
299 $this->
assertEquals( $a, $record->getSlot(
'a' )->getContent() );
300 $this->
assertEquals( $x, $record->getSlot(
'b' )->getContent() );
306 $title = $this->
getMock( Title::class );
309 $user = $this->
getMock( User::class );
313 ->disableOriginalConstructor()
319 yield
'empty' => [
$rev ];
323 $rev->setUser( $user );
324 $rev->setComment( $comment );
325 yield
'no timestamp' => [
$rev ];
328 $rev->setUser( $user );
329 $rev->setComment( $comment );
330 $rev->setTimestamp(
'20101010000000' );
331 yield
'no content' => [
$rev ];
335 $rev->setComment( $comment );
336 $rev->setTimestamp(
'20101010000000' );
337 yield
'no user' => [
$rev ];
340 $rev->setUser( $user );
342 $rev->setTimestamp(
'20101010000000' );
343 yield
'no comment' => [
$rev ];
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Content object implementation for representing flat text.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Content object for wiki text pages.
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))