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

Change subject: Add test cases for extractTarget
......................................................................


Add test cases for extractTarget

Test situation where the local domain is specified.

Change-Id: Ic27c3c8b1bd80b7f60bf90b1f20238420b43dbff
---
M tests/MassMessageContentHandlerTest.php
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/MassMessageContentHandlerTest.php 
b/tests/MassMessageContentHandlerTest.php
index e174f9a..25b6c01 100644
--- a/tests/MassMessageContentHandlerTest.php
+++ b/tests/MassMessageContentHandlerTest.php
@@ -126,8 +126,12 @@
        public static function provideExtractTarget() {
                return array(
                        array( 'A', array( 'title' => 'A' ) ),
+                       array( '[email protected]', array( 'title' => 'A' 
) ),
+                       array( '[email protected]@test.wikipedia.org', array( 
'title' => '[email protected]' ) ),
                        array( '[email protected]', array( 'title' => 'A', 
'site' => 'en.wikipedia.org' ) ),
                        array( '[email protected]', array( 'title' => 'A', 
'site' => 'en.wikipedia.org' ) ),
+                       array( '[email protected]@en.wikipedia.org',
+                               array( 'title' => '[email protected]', 'site' => 
'en.wikipedia.org' ) ),
                        array( '_', array( 'errors' => array('invalidtitle' ) ) 
),
                        array( '[email protected]', array( 'title' => 'A', 
'errors' => array( 'invalidsite' ) ) ),
                        array( '[email protected]', array( 'errors' => array( 
'invalidtitle', 'invalidsite' ) ) )
@@ -141,6 +145,8 @@
         * @param array $expected Parsed target
         */
        public function testExtractTarget( $targetString, $expected ) {
+               // Temporarily set $wgCanonicalServer for this test so its 
value is predictable.
+               $this->setMwGlobals( 'wgCanonicalServer', 
'http://test.wikipedia.org' );
                $this->assertEquals(
                        $expected,
                        MassMessageListContentHandler::extractTarget( 
$targetString )

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic27c3c8b1bd80b7f60bf90b1f20238420b43dbff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassMessage
Gerrit-Branch: contenthandler
Gerrit-Owner: Wctaiwan <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to