jenkins-bot has submitted this change and it was merged.

Change subject: Follow up for change in ConfirmEdit
......................................................................


Follow up for change in ConfirmEdit

ConfirmEdit's shouldCheck requires the 4th parameter to be an
instance of IContextSource. Follow up to conform to this.

Depends on Iab3e94e642c965bec in ConfirmEdit (merged)

Bug: T93961
Change-Id: Ifc026f86eba3eedddf5309c75a21b6c85dd84735
---
M includes/SpamFilter/ConfirmEdit.php
M tests/phpunit/SpamFilter/ConfirmEditTest.php
2 files changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Catrope: Looks good to me, approved
  Florianschmidtwelzow: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/SpamFilter/ConfirmEdit.php 
b/includes/SpamFilter/ConfirmEdit.php
index 02e904f..02cb578 100644
--- a/includes/SpamFilter/ConfirmEdit.php
+++ b/includes/SpamFilter/ConfirmEdit.php
@@ -29,7 +29,7 @@
 
                // first check if the submitted content is offensive (as 
flagged by
                // ConfirmEdit), next check for a (valid) captcha to have been 
entered
-               if ( $captcha->shouldCheck( $wikiPage, $newContent, false, 
false, $oldContent ) && !$captcha->passCaptchaLimited() ) {
+               if ( $captcha->shouldCheck( $wikiPage, $newContent, false, 
$context, $oldContent ) && !$captcha->passCaptchaLimited() ) {
                        // getting here means we submitted bad content without 
good captcha
                        // result (or any captcha result at all) - let's get 
the captcha
                        // HTML to display as error message!
diff --git a/tests/phpunit/SpamFilter/ConfirmEditTest.php 
b/tests/phpunit/SpamFilter/ConfirmEditTest.php
index 548d429..c66eea0 100644
--- a/tests/phpunit/SpamFilter/ConfirmEditTest.php
+++ b/tests/phpunit/SpamFilter/ConfirmEditTest.php
@@ -24,11 +24,21 @@
                $oldRevision = PostRevision::create( $workflow, $user, 'foo', 
'wikitext' );
                $newRevision = $oldRevision->newNextRevision( $user, 'bar', 
'wikitext', 'change-type', $title );
 
+               $request = $this->getMock( 'WebRequest' );
+               $request->expects( $this->any() )
+                       ->method( 'wasPosted' )
+                       ->will( $this->returnValue( true ) );
+
                $context = $this->getMock( 'IContextSource' );
+
                $context->expects( $this->any() )
                        ->method( 'getUser' )
                        ->will( $this->returnValue( $user ) );
 
+               $context->expects( $this->any() )
+                       ->method( 'getRequest' )
+                       ->will( $this->returnValue( $request ) );
+
                $status = $filter->validate( $context, $newRevision, 
$oldRevision, $title );
                $this->assertInstanceOf( 'Status', $status );
                $this->assertTrue( $status->isGood() );

-- 
To view, visit https://gerrit.wikimedia.org/r/231255
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc026f86eba3eedddf5309c75a21b6c85dd84735
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to