1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
|
<?php
use MediaWiki\EditPage\EditPage;
use MediaWiki\EditPage\SpamChecker;
use MediaWiki\MainConfigNames;
use MediaWiki\Permissions\PermissionManager;
use MediaWiki\Request\FauxRequest;
use MediaWiki\Title\Title;
use Wikimedia\Rdbms\ReadOnlyMode;
/**
* Integration tests for the various edit constraints, ensuring
* that they result in failures as expected
*
* @covers MediaWiki\EditPage\EditPage::internalAttemptSave
*
* @group Editing
* @group Database
* @group medium
*/
class EditPageConstraintsTest extends MediaWikiLangTestCase {
protected function setUp(): void {
parent::setUp();
$contLang = $this->getServiceContainer()->getContentLanguage();
$this->overrideConfigValues( [
MainConfigNames::ExtraNamespaces => [
12312 => 'Dummy',
12313 => 'Dummy_talk',
],
MainConfigNames::NamespaceContentModels => [ 12312 => 'testing' ],
MainConfigNames::LanguageCode => $contLang->getCode(),
] );
$this->mergeMwGlobalArrayValue(
'wgContentHandlers',
[ 'testing' => 'DummyContentHandlerForTesting' ]
);
}
/**
* Based on method in EditPageTest
* Performs an edit and checks the result matches the expected failure code
*
* @param string|Title $title The title of the page to edit
* @param string|null $baseText Some text to create the page with before attempting the edit.
* @param User|null $user The user to perform the edit as.
* @param array $edit An array of request parameters used to define the edit to perform.
* Some well known fields are:
* * wpTextbox1: the text to submit
* * wpSummary: the edit summary
* * wpEditToken: the edit token (will be inserted if not provided)
* * wpEdittime: timestamp of the edit's base revision (will be inserted
* if not provided)
* * editRevId: revision ID of the edit's base revision (optional)
* * wpStarttime: timestamp when the edit started (will be inserted if not provided)
* * wpSectionTitle: the section to edit
* * wpMinorEdit: mark as minor edit
* * wpWatchthis: whether to watch the page
* @param int $expectedCode The expected result code (EditPage::AS_XXX constants).
* @param string $message Message to show along with any error message.
*
* @return WikiPage The page that was just edited, useful for getting the edit's rev_id, etc.
*/
protected function assertEdit(
$title,
$baseText,
?User $user,
array $edit,
$expectedCode,
$message
) {
if ( is_string( $title ) ) {
$ns = $this->getDefaultWikitextNS();
$title = Title::newFromText( $title, $ns );
}
$this->assertNotNull( $title );
$wikiPageFactory = $this->getServiceContainer()->getWikiPageFactory();
$page = $wikiPageFactory->newFromTitle( $title );
if ( $user == null ) {
$user = $this->getTestUser()->getUser();
}
if ( $baseText !== null ) {
$content = ContentHandler::makeContent( $baseText, $title );
$page->doUserEditContent( $content, $user, "base text for test" );
// Set the latest timestamp back a while
$dbw = wfGetDB( DB_PRIMARY );
$dbw->newUpdateQueryBuilder()
->update( 'revision' )
->set( [ 'rev_timestamp' => $dbw->timestamp( '20120101000000' ) ] )
->where( [ 'rev_id' => $page->getLatest() ] )
->execute();
$page->clear();
$content = $page->getContent();
$this->assertInstanceOf( TextContent::class, $content );
$currentText = $content->getText();
# EditPage rtrim() the user input, so we alter our expected text
# to reflect that.
$this->assertEquals(
rtrim( $baseText ),
rtrim( $currentText ),
'page should have the text specified'
);
}
if ( !isset( $edit['wpEditToken'] ) ) {
$edit['wpEditToken'] = $user->getEditToken();
}
if ( !isset( $edit['wpEdittime'] ) && !isset( $edit['editRevId'] ) ) {
$edit['wpEdittime'] = $page->exists() ? $page->getTimestamp() : '';
}
if ( !isset( $edit['wpStarttime'] ) ) {
$edit['wpStarttime'] = wfTimestampNow();
}
if ( !isset( $edit['wpUnicodeCheck'] ) ) {
$edit['wpUnicodeCheck'] = EditPage::UNICODE_CHECK;
}
$req = new FauxRequest( $edit, true ); // session ??
$context = new RequestContext();
$context->setRequest( $req );
$context->setTitle( $title );
$context->setUser( $user );
$article = new Article( $title );
$article->setContext( $context );
$ep = new EditPage( $article );
$ep->setContextTitle( $title );
$ep->importFormData( $req );
$bot = !empty( $edit['bot'] );
// this is where the edit happens!
// Note: don't want to use EditPage::attemptSave, because it messes with $wgOut
// and throws exceptions like PermissionsError
$status = $ep->internalAttemptSave( $result, $bot );
// check edit code
$this->assertSame(
$expectedCode,
$status->value,
"Expected result code mismatch. $message"
);
return $wikiPageFactory->newFromTitle( $title );
}
/** AccidentalRecreationConstraint integration */
public function testAccidentalRecreationConstraint() {
// Make sure it exists
$this->getExistingTestPage( 'AccidentalRecreationConstraintPage' );
// And now delete it, so that there is a deletion log
$page = $this->getNonexistingTestPage( 'AccidentalRecreationConstraintPage' );
$title = $page->getTitle();
// Set the time of the deletion to be a specific time, so we can be sure to start the
// edit before it. Since the constraint will query for the most recent timestamp,
// update *all* deletion logs for the page to the same timestamp (1 January 2020)
$dbw = wfGetDB( DB_PRIMARY );
$dbw->newUpdateQueryBuilder()
->update( 'logging' )
->set( [ 'log_timestamp' => $dbw->timestamp( '20200101000000' ) ] )
->where( [
'log_namespace' => $title->getNamespace(),
'log_title' => $title->getDBkey(),
'log_type' => 'delete',
'log_action' => 'delete',
] )
->caller( __METHOD__ )->execute();
$user = $this->getTestUser()->getUser();
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit rights to pass EditRightConstraint and reach AccidentalRecreationConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit' ] );
// Started the edit on 1 January 2019, page was deleted on 1 January 2020
$edit = [
'wpTextbox1' => 'New content',
'wpStarttime' => '20190101000000'
];
$this->assertEdit(
$title,
null,
$user,
$edit,
EditPage::AS_ARTICLE_WAS_DELETED,
'expected AS_ARTICLE_WAS_DELETED update'
);
}
/** AutoSummaryMissingSummaryConstraint integration */
public function testAutoSummaryMissingSummaryConstraint() {
// Require the summary
$this->mergeMwGlobalArrayValue(
'wgDefaultUserOptions',
[ 'forceeditsummary' => 1 ]
);
$page = $this->getExistingTestPage( 'AutoSummaryMissingSummaryConstraint page does exist' );
$title = $page->getTitle();
$user = $this->getTestUser()->getUser();
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit rights to pass EditRightConstraint and reach NewSectionMissingSubjectConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit' ] );
$edit = [
'wpTextbox1' => 'New content, different from base content',
'wpSummary' => 'SameAsAutoSummary',
'wpAutoSummary' => md5( 'SameAsAutoSummary' )
];
$this->assertEdit(
$title,
'Base content, different from new content',
$user,
$edit,
EditPage::AS_SUMMARY_NEEDED,
'expected AS_SUMMARY_NEEDED update'
);
}
/** ChangeTagsConstraint integration */
public function testChangeTagsConstraint() {
// Remove rights
$this->mergeMwGlobalArrayValue(
'wgRevokePermissions',
[ 'user' => [ 'applychangetags' => true ] ]
);
$edit = [
'wpTextbox1' => 'Text',
'wpChangeTags' => 'tag-name'
];
$this->assertEdit(
'EditPageTest_changeTagsConstraint',
null,
null,
$edit,
EditPage::AS_CHANGE_TAG_ERROR,
'expected AS_CHANGE_TAG_ERROR update'
);
}
/** ContentModelChangeConstraint integration */
public function testContentModelChangeConstraint() {
$user = $this->getTestUser()->getUser();
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit rights to pass EditRightConstraint and reach ContentModelChangeConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit' ] );
$edit = [
'wpTextbox1' => 'New text goes here',
'wpSummary' => 'Summary',
'model' => CONTENT_MODEL_TEXT,
'format' => CONTENT_FORMAT_TEXT,
];
$title = Title::makeTitle( NS_MAIN, 'Example' );
$this->assertSame(
CONTENT_MODEL_WIKITEXT,
$title->getContentModel(),
'title should start as wikitext content model'
);
$this->assertEdit(
$title,
'Base text',
$user,
$edit,
EditPage::AS_NO_CHANGE_CONTENT_MODEL,
'expected AS_NO_CHANGE_CONTENT_MODEL update'
);
}
/** CreationPermissionConstraint integration */
public function testCreationPermissionConstraint() {
$page = $this->getNonexistingTestPage( 'CreationPermissionConstraint page does not exist' );
$title = $page->getTitle();
$user = $this->getTestUser()->getUser();
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit rights to pass EditRightConstraint and reach CreationPermissionConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit' ] );
$edit = [
'wpTextbox1' => 'Page content',
'wpSummary' => 'Summary'
];
$this->assertEdit(
$title,
null,
$user,
$edit,
EditPage::AS_NO_CREATE_PERMISSION,
'expected AS_NO_CREATE_PERMISSION creation'
);
}
/** DefaultTextConstraint integration */
public function testDefaultTextConstraint() {
$page = $this->getNonexistingTestPage( 'DefaultTextConstraint page does not exist' );
$title = $page->getTitle();
$user = $this->getTestUser()->getUser();
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit and createpage rights to pass EditRightConstraint and CreationPermissionConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit', 'createpage' ] );
$edit = [
'wpTextbox1' => '',
'wpSummary' => 'Summary'
];
$this->assertEdit(
$title,
null,
$user,
$edit,
EditPage::AS_BLANK_ARTICLE,
'expected AS_BLANK_ARTICLE creation'
);
}
/**
* EditFilterMergedContentHookConstraint integration
* @dataProvider provideTestEditFilterMergedContentHookConstraint
* @param bool $hookReturn
* @param ?int $statusValue
* @param bool $statusFatal
* @param int $expectedFailure
* @param string $expectedFailureStr
*/
public function testEditFilterMergedContentHookConstraint(
bool $hookReturn,
$statusValue,
bool $statusFatal,
int $expectedFailure,
string $expectedFailureStr
) {
$this->setTemporaryHook(
'EditFilterMergedContent',
static function ( $context, $content, $status, $summary, $user, $minorEdit )
use ( $hookReturn, $statusValue, $statusFatal )
{
if ( $statusValue !== null ) {
$status->value = $statusValue;
}
if ( $statusFatal ) {
$status->fatal( 'SomeErrorInTheHook' );
}
return $hookReturn;
}
);
$user = $this->getTestUser()->getUser();
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit and createpage rights to pass EditRightConstraint and CreationPermissionConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit', 'createpage' ] );
$edit = [
'wpTextbox1' => 'Text',
'wpSummary' => 'Summary'
];
$this->assertEdit(
'EditPageTest_testEditFilterMergedContentHookConstraint',
null,
$user,
$edit,
$expectedFailure,
"expected $expectedFailureStr creation"
);
}
public static function provideTestEditFilterMergedContentHookConstraint() {
yield 'Hook returns false, status is good, no value set' => [
false, null, false, EditPage::AS_HOOK_ERROR_EXPECTED, 'AS_HOOK_ERROR_EXPECTED'
];
yield 'Hook returns false, status is good, value set' => [
false, 1234567, false, 1234567, 'custom value 1234567'
];
yield 'Hook returns false, status is not good' => [
false, null, true, EditPage::AS_HOOK_ERROR_EXPECTED, 'AS_HOOK_ERROR_EXPECTED'
];
yield 'Hook returns true, status is not ok' => [
true, null, true, EditPage::AS_HOOK_ERROR_EXPECTED, 'AS_HOOK_ERROR_EXPECTED'
];
}
/**
* EditRightConstraint integration
* @dataProvider provideTestEditRightConstraint
* @param bool $anon
* @param int $expectedErrorCode
*/
public function testEditRightConstraint( $anon, $expectedErrorCode ) {
if ( $anon ) {
$user = $this->getServiceContainer()->getUserFactory()->newAnonymous( '127.0.0.1' );
} else {
$user = $this->getTestUser()->getUser();
}
$permissionManager = $this->getServiceContainer()->getPermissionManager();
$permissionManager->overrideUserRightsForTesting( $user, [] );
$edit = [
'wpTextbox1' => 'Page content',
'wpSummary' => 'Summary'
];
$this->assertEdit(
'EditPageTest_noEditRight',
'base text',
$user,
$edit,
$expectedErrorCode,
'expected AS_READ_ONLY_PAGE_* update'
);
}
public static function provideTestEditRightConstraint() {
yield 'Anonymous user' => [ true, EditPage::AS_READ_ONLY_PAGE_ANON ];
yield 'Registered user' => [ false, EditPage::AS_READ_ONLY_PAGE_LOGGED ];
}
/**
* ImageRedirectConstraint integration
* @dataProvider provideTestImageRedirectConstraint
* @param bool $anon
* @param int $expectedErrorCode
*/
public function testImageRedirectConstraint( $anon, $expectedErrorCode ) {
if ( $anon ) {
$user = $this->getServiceContainer()->getUserFactory()->newAnonymous( '127.0.0.1' );
} else {
$user = $this->getTestUser()->getUser();
}
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit rights to pass EditRightConstraint and reach ImageRedirectConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit' ] );
$edit = [
'wpTextbox1' => '#REDIRECT [[File:Example other file.jpg]]',
'wpSummary' => 'Summary'
];
$title = Title::makeTitle( NS_FILE, 'Example.jpg' );
$this->assertEdit(
$title,
null,
$user,
$edit,
$expectedErrorCode,
'expected AS_IMAGE_REDIRECT_* update'
);
}
public static function provideTestImageRedirectConstraint() {
yield 'Anonymous user' => [ true, EditPage::AS_IMAGE_REDIRECT_ANON ];
yield 'Registered user' => [ false, EditPage::AS_IMAGE_REDIRECT_LOGGED ];
}
/** MissingCommentConstraint integration */
public function testMissingCommentConstraint() {
$page = $this->getExistingTestPage( 'MissingCommentConstraint page does exist' );
$title = $page->getTitle();
$user = $this->getTestUser()->getUser();
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit rights to pass EditRightConstraint and reach MissingCommentConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit' ] );
$edit = [
'wpTextbox1' => '',
'wpSection' => 'new',
'wpSummary' => 'Summary'
];
$this->assertEdit(
$title,
null,
$user,
$edit,
EditPage::AS_TEXTBOX_EMPTY,
'expected AS_TEXTBOX_EMPTY update'
);
}
/** NewSectionMissingSubjectConstraint integration */
public function testNewSectionMissingSubjectConstraint() {
// Require the summary
$this->mergeMwGlobalArrayValue(
'wgDefaultUserOptions',
[ 'forceeditsummary' => 1 ]
);
$page = $this->getExistingTestPage( 'NewSectionMissingSubjectConstraint page does exist' );
$title = $page->getTitle();
$user = $this->getTestUser()->getUser();
$permissionManager = $this->getServiceContainer()->getPermissionManager();
// Needs edit rights to pass EditRightConstraint and reach NewSectionMissingSubjectConstraint
$permissionManager->overrideUserRightsForTesting( $user, [ 'edit' ] );
$edit = [
'wpTextbox1' => 'Comment',
'wpSection' => 'new',
'wpSummary' => ''
];
$this->assertEdit(
$title,
null,
$user,
$edit,
EditPage::AS_SUMMARY_NEEDED,
'expected AS_SUMMARY_NEEDED update'
);
}
/** PageSizeConstraint integration */
public function testPageSizeConstraintBeforeMerge() {
// Max size: 1 kibibyte
$this->overrideConfigValue( MainConfigNames::MaxArticleSize, 1 );
$edit = [
'wpTextbox1' => str_repeat( 'text', 1000 )
];
$this->assertEdit(
'EditPageTest_pageSizeConstraintBeforeMerge',
null,
null,
$edit,
EditPage::AS_CONTENT_TOO_BIG,
'expected AS_CONTENT_TOO_BIG update'
);
}
/** PageSizeConstraint integration */
public function testPageSizeConstraintAfterMerge() {
// Max size: 1 kibibyte
$this->overrideConfigValue( MainConfigNames::MaxArticleSize, 1 );
$edit = [
'wpSection' => 'new',
'wpTextbox1' => str_repeat( 'b', 600 )
];
$this->assertEdit(
'EditPageTest_pageSizeConstraintAfterMerge',
str_repeat( 'a', 600 ),
null,
$edit,
EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED,
'expected AS_MAX_ARTICLE_SIZE_EXCEEDED update'
);
}
/** ReadOnlyConstraint integration */
public function testReadOnlyConstraint() {
$readOnlyMode = $this->createMock( ReadOnlyMode::class );
$readOnlyMode->method( 'isReadOnly' )->willReturn( true );
$this->setService( 'ReadOnlyMode', $readOnlyMode );
$edit = [
'wpTextbox1' => 'Text goes here'
];
$this->assertEdit(
'EditPageTest_readOnlyConstraint',
null,
null,
$edit,
EditPage::AS_READ_ONLY_PAGE,
'expected AS_READ_ONLY_PAGE update'
);
}
/** SelfRedirectConstraint integration */
public function testSelfRedirectConstraint() {
// Use a page that does not exist to be sure that it is not already a self redirect
$page = $this->getNonexistingTestPage( 'SelfRedirectConstraint page does not exist' );
$title = $page->getTitle();
$edit = [
'wpTextbox1' => '#REDIRECT [[SelfRedirectConstraint page does not exist]]',
'wpSummary' => 'Redirect to self'
];
$this->assertEdit(
$title,
'zero',
null,
$edit,
EditPage::AS_SELF_REDIRECT,
'expected AS_SELF_REDIRECT update'
);
}
/** SimpleAntiSpamConstraint integration */
public function testSimpleAntiSpamConstraint() {
$edit = [
'wpTextbox1' => 'one',
'wpSummary' => 'first update',
'wpAntispam' => 'tatata'
];
$this->assertEdit(
'EditPageTest_testUpdatePageSpamError',
'zero',
null,
$edit,
EditPage::AS_SPAM_ERROR,
'expected AS_SPAM_ERROR update'
);
}
/** SpamRegexConstraint integration */
public function testSpamRegexConstraint() {
$spamChecker = $this->createMock( SpamChecker::class );
$spamChecker->method( 'checkContent' )
->willReturnArgument( 0 );
$spamChecker->method( 'checkSummary' )
->willReturnArgument( 0 );
$this->setService( 'SpamChecker', $spamChecker );
$edit = [
'wpTextbox1' => 'two',
'wpSummary' => 'spam summary'
];
$this->assertEdit(
'EditPageTest_testUpdatePageSpamRegexError',
'zero',
null,
$edit,
EditPage::AS_SPAM_ERROR,
'expected AS_SPAM_ERROR update'
);
}
/** UserBlockConstraint integration */
public function testUserBlockConstraint() {
$user = $this->createMock( User::class );
$user->method( 'getName' )->willReturn( 'NameGoesHere' );
$user->method( 'getId' )->willReturn( 12345 );
$permissionManager = $this->createMock( PermissionManager::class );
// Needs edit rights to pass EditRightConstraint and reach UserBlockConstraint
$permissionManager->method( 'userHasRight' )->willReturn( true );
$permissionManager->method( 'userCan' )->willReturn( true );
// Not worried about the specifics of the method call, those are tested in
// the UserBlockConstraintTest
$permissionManager->method( 'isBlockedFrom' )->willReturn( true );
$this->setService( 'PermissionManager', $permissionManager );
$edit = [
'wpTextbox1' => 'Page content',
'wpSummary' => 'Summary'
];
$this->assertEdit(
'EditPageTest_userBlocked',
'base text',
null,
$edit,
EditPage::AS_BLOCKED_PAGE_FOR_USER,
'expected AS_BLOCKED_PAGE_FOR_USER update'
);
}
/** UserRateLimitConstraint integration */
public function testUserRateLimitConstraint() {
$this->setTemporaryHook(
'PingLimiter',
static function ( $user, $action, &$result, $incrBy ) {
// Always fail
$result = true;
return false;
}
);
$edit = [
'wpTextbox1' => 'Text goes here'
];
$this->assertEdit(
'EditPageTest_userRateLimitConstraint',
null,
null,
$edit,
EditPage::AS_RATE_LIMITED,
'expected AS_RATE_LIMITED update'
);
}
}
|