Thiemo Mättig (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379567 )

Change subject: Remove methods from Summary that are not used outside of tests
......................................................................

Remove methods from Summary that are not used outside of tests

Change-Id: I8e258e7b653d8879b1d63337c1cfa5378080aa24
---
M lib/includes/Summary.php
M lib/tests/phpunit/SummaryTest.php
M repo/tests/phpunit/includes/Api/StatementModificationHelperTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpDescriptionTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpLabelTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
M repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php
M repo/tests/phpunit/includes/SummaryFormatterTest.php
8 files changed, 12 insertions(+), 52 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/67/379567/1

diff --git a/lib/includes/Summary.php b/lib/includes/Summary.php
index bcd154b..066ff9c 100644
--- a/lib/includes/Summary.php
+++ b/lib/includes/Summary.php
@@ -82,24 +82,6 @@
        }
 
        /**
-        * Set the module part of the autocomment
-        *
-        * @param string $name
-        */
-       public function setModuleName( $name ) {
-               $this->moduleName = (string)$name;
-       }
-
-       /**
-        * Get the module part of the autocomment
-        *
-        * @return string|null
-        */
-       public function getModuleName() {
-               return $this->moduleName;
-       }
-
-       /**
         * Set the action part of the autocomment
         *
         * @param string|null $name
@@ -109,18 +91,7 @@
        }
 
        /**
-        * Get the action part of the autocomment
-        *
-        * @return string|null
-        */
-       public function getActionName() {
-               return $this->actionName;
-       }
-
-       /**
-        * Get the user-provided edit summary
-        *
-        * @return string|null
+        * @return string|null The user-provided edit summary, or null if none 
was given.
         */
        public function getUserSummary() {
                return $this->userSummary;
diff --git a/lib/tests/phpunit/SummaryTest.php 
b/lib/tests/phpunit/SummaryTest.php
index 371a190..bec8398 100644
--- a/lib/tests/phpunit/SummaryTest.php
+++ b/lib/tests/phpunit/SummaryTest.php
@@ -54,10 +54,10 @@
                $summary = new Summary( 'summarytest' );
 
                $summary->setAction( "testing" );
-               $this->assertEquals( "testing", $summary->getActionName() );
+               $this->assertSame( 'testing', $summary->getMessageKey() );
 
                $summary->setAction( "besting" );
-               $this->assertEquals( "besting", $summary->getActionName() );
+               $this->assertSame( 'besting', $summary->getMessageKey() );
 
                $this->assertEquals( "summarytest-besting", 
$summary->getMessageKey() );
        }
@@ -68,9 +68,6 @@
 
                $summary->setAction( "testing" );
                $this->assertEquals( "summarytest-testing", 
$summary->getMessageKey() );
-
-               $summary->setModuleName( "" );
-               $this->assertEquals( "testing", $summary->getMessageKey() );
        }
 
 }
diff --git 
a/repo/tests/phpunit/includes/Api/StatementModificationHelperTest.php 
b/repo/tests/phpunit/includes/Api/StatementModificationHelperTest.php
index 1e26475..3241209 100644
--- a/repo/tests/phpunit/includes/Api/StatementModificationHelperTest.php
+++ b/repo/tests/phpunit/includes/Api/StatementModificationHelperTest.php
@@ -60,14 +60,14 @@
                        [ 'summary' => $customSummary ],
                        $this->createCreateClaimApiModule()
                );
-               $this->assertEquals( 'wbcreateclaim', $summary->getModuleName() 
);
+               $this->assertSame( 'wbcreateclaim', $summary->getMessageKey() );
                $this->assertEquals( $customSummary, $summary->getUserSummary() 
);
 
                $summary = $helper->createSummary(
                        [],
                        $this->createCreateClaimApiModule()
                );
-               $this->assertEquals( 'wbcreateclaim', $summary->getModuleName() 
);
+               $this->assertSame( 'wbcreateclaim', $summary->getMessageKey() );
                $this->assertNull( $summary->getUserSummary() );
        }
 
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpDescriptionTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpDescriptionTest.php
index 28a63e5..bb8e833 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpDescriptionTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpDescriptionTest.php
@@ -145,7 +145,7 @@
 
                $changeOp->apply( $entity, $summary );
 
-               $this->assertEquals( $summaryExpectedAction, 
$summary->getActionName() );
+               $this->assertSame( $summaryExpectedAction, 
$summary->getMessageKey() );
                $this->assertEquals( $summaryExpectedLanguage, 
$summary->getLanguageCode() );
        }
 
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpLabelTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpLabelTest.php
index fd66ae7..36d8c3d 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpLabelTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpLabelTest.php
@@ -147,7 +147,7 @@
 
                $changeOp->apply( $entity, $summary );
 
-               $this->assertEquals( $summaryExpectedAction, 
$summary->getActionName() );
+               $this->assertSame( $summaryExpectedAction, 
$summary->getMessageKey() );
                $this->assertEquals( $summaryExpectedLanguage, 
$summary->getLanguageCode() );
        }
 
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
index a72264f..01fdf70 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
@@ -206,7 +206,7 @@
         * @dataProvider summaryTestProvider
         */
        public function testApplySummary(
-               $expectedAction,
+               $expectedMessageKey,
                array $expectedArguments,
                array $sitelinks,
                ChangeOpSiteLink $changeOpSiteLink
@@ -217,10 +217,7 @@
                $summary = new Summary();
                $changeOpSiteLink->apply( $item, $summary );
 
-               $this->assertSame(
-                       $expectedAction,
-                       $summary->getActionName()
-               );
+               $this->assertSame( $expectedMessageKey, 
$summary->getMessageKey() );
 
                $this->assertEquals(
                        $expectedArguments,
diff --git a/repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php 
b/repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php
index bc495ed..d5bc1a6 100644
--- a/repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php
+++ b/repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php
@@ -136,8 +136,7 @@
                foreach ( $newStatements as $newStatement ) {
                        $summary = $claimSummaryBuilder->buildClaimSummary( 
null, $newStatement );
                        $this->assertInstanceOf( Summary::class, $summary, 
'this should return a Summary object' );
-                       $this->assertEquals( 'wbsetclaim', 
$summary->getModuleName() );
-                       $this->assertEquals( 'create', 
$summary->getActionName() );
+                       $this->assertEquals( 'wbsetclaim-create', 
$summary->getMessageKey() );
                }
        }
 
@@ -156,8 +155,7 @@
 
                $summary = $claimSummaryBuilder->buildClaimSummary( 
$originalStatement, $modifiedStatement );
                $this->assertInstanceOf( Summary::class, $summary, 'this should 
return a Summary object' );
-               $this->assertEquals( 'wbsetclaim', $summary->getModuleName() );
-               $this->assertEquals( $action, $summary->getActionName() );
+               $this->assertEquals( 'wbsetclaim-' . $action, 
$summary->getMessageKey() );
        }
 
 }
diff --git a/repo/tests/phpunit/includes/SummaryFormatterTest.php 
b/repo/tests/phpunit/includes/SummaryFormatterTest.php
index 6847a6c..5b4f313 100644
--- a/repo/tests/phpunit/includes/SummaryFormatterTest.php
+++ b/repo/tests/phpunit/includes/SummaryFormatterTest.php
@@ -119,10 +119,7 @@
         * @dataProvider providerFormatAutoComment
         */
        public function testFormatAutoComment( $module, $action, $language, 
array $parts, $expected ) {
-               $summary = new Summary();
-               $summary->setModuleName( $module );
-               $summary->setAction( $action );
-               $summary->setLanguage( $language );
+               $summary = new Summary( $module, $action, $language );
 
                if ( !empty( $parts ) ) {
                        call_user_func_array( [ $summary, 'addAutoCommentArgs' 
], $parts );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e258e7b653d8879b1d63337c1cfa5378080aa24
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

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

Reply via email to