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

Change subject: (Bug 52396) use getSubject()->getDBkey() instead
......................................................................


(Bug 52396) use getSubject()->getDBkey() instead

Change-Id: Ifb6e7c0b9fe68efdf0155efa92b36be4c8031394
---
M includes/BasePropertyAnnotator.php
M tests/phpunit/includes/BasePropertyAnnotatorTest.php
2 files changed, 44 insertions(+), 20 deletions(-)

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



diff --git a/includes/BasePropertyAnnotator.php 
b/includes/BasePropertyAnnotator.php
index dc9289f..4734ca9 100644
--- a/includes/BasePropertyAnnotator.php
+++ b/includes/BasePropertyAnnotator.php
@@ -105,7 +105,7 @@
         * @return BasePropertyAnnotator
         */
        public function addDefaultSort( $defaultSort ) {
-               $sortkey = $defaultSort ? $defaultSort : str_replace( '_', ' ', 
$this->semanticData->getSubject()->getTitle()->getDBkey() );
+               $sortkey = $defaultSort ? $defaultSort : str_replace( '_', ' ', 
$this->semanticData->getSubject()->getDBkey() );
                $this->semanticData->addPropertyObjectValue(
                        new DIProperty( DIProperty::TYPE_SORTKEY ),
                        new SMWDIBlob( $sortkey )
diff --git a/tests/phpunit/includes/BasePropertyAnnotatorTest.php 
b/tests/phpunit/includes/BasePropertyAnnotatorTest.php
index 67c69e9..0ecc1b0 100644
--- a/tests/phpunit/includes/BasePropertyAnnotatorTest.php
+++ b/tests/phpunit/includes/BasePropertyAnnotatorTest.php
@@ -51,7 +51,7 @@
         *
         * @return BasePropertyAnnotator
         */
-       private function getInstance( SemanticData $semanticData = null, 
$settings = array() ) {
+       private function newInstance( SemanticData $semanticData = null, 
$settings = array() ) {
 
                if ( $semanticData === null ) {
                        $semanticData = 
$this->newMockObject()->getMockSemanticData();
@@ -66,7 +66,7 @@
         * @since 1.9
         */
        public function testConstructor() {
-               $this->assertInstanceOf( $this->getClass(), 
$this->getInstance() );
+               $this->assertInstanceOf( $this->getClass(), 
$this->newInstance() );
        }
 
        /**
@@ -86,10 +86,14 @@
                        $this->newSubject( $this->newTitle( $setup['namespace'] 
) )
                );
 
-               $instance = $this->getInstance( $semanticData, 
$setup['settings'] );
+               $instance = $this->newInstance( $semanticData, 
$setup['settings'] );
                $instance->addCategories( $setup['categories'] );
 
-               $this->assertSemanticData( $semanticData, $expected );
+               $this->assertSemanticData(
+                       $semanticData,
+                       $expected,
+                       'asserts that addCategories() adds expected triples'
+               );
 
        }
 
@@ -115,16 +119,19 @@
                ) )->getMockObsever();
 
                // Create instance and attach mock Observer
-               $instance = $this->getInstance( $semanticData, 
$setup['settings'] );
+               $instance = $this->newInstance( $semanticData, 
$setup['settings'] );
                $instance->attach( $mockObserver );
                $instance->addCategories( $setup['categories'] );
 
-               $this->assertSemanticData( $semanticData, $expected );
+               $this->assertSemanticData(
+                       $semanticData,
+                       $expected,
+                       'asserts that addCategories() adds expected triples'
+               );
 
-               // Just verify that the Publisher was able to reach the Observer
                $this->assertTrue(
                        $this->observerStatus,
-                       'Failed asserting that the invoked Observer received a 
notification from the Publisher (Subject)'
+                       'asserts that the invoked Observer received a 
notification from the Publisher (Subject)'
                );
 
        }
@@ -149,13 +156,18 @@
                $parserData   = $this->getParserData( $title, $parserOutput );
 
                // Create instance and attach mock Observer
-               $instance = $this->getInstance( $parserData->getData(), 
$setup['settings'] );
+               $instance = $this->newInstance( $parserData->getData(), 
$setup['settings'] );
                $instance->attach( $parserData );
                $instance->addCategories( $setup['categories'] );
 
                // Re-read data from the $parserOutput object
                $newParserData = $this->getParserData( $title, $parserOutput );
-               $this->assertSemanticData( $newParserData->getData(), $expected 
);
+
+               $this->assertSemanticData(
+                       $newParserData->getData(),
+                       $expected,
+                       'asserts that addCategories() adds expected triples'
+               );
 
        }
 
@@ -180,17 +192,21 @@
                ) )->getMockObsever();
 
                // Create instance and attach mock Observer
-               $instance = $this->getInstance( $semanticData );
+               $instance = $this->newInstance( $semanticData );
                $instance->attach( $mockObserver );
                $instance->addDefaultSort( $setup['sort'] );
 
-               $this->assertSemanticData( $semanticData, $expected );
+               $this->assertSemanticData(
+                       $semanticData,
+                       $expected,
+                       'asserts that addDefaultSort() adds expected triples'
+               );
 
-               // Just verify that the Publisher was able to reach the Observer
                $this->assertTrue(
                        $this->observerStatus,
-                       'Failed asserting that the invoked Observer received a 
notification from the Publisher (Subject)'
+                       'asserts that the invoked Observer received a 
notification from the Publisher (Subject)'
                );
+
        }
 
        /**
@@ -219,21 +235,29 @@
                ) )->getMockObsever();
 
                // Create instance and attach mock Observer
-               $instance = $this->getInstance( $semanticData, 
$setup['settings'] );
+               $instance = $this->newInstance( $semanticData, 
$setup['settings'] );
                $instance->attach( $mockObserver );
                $instance->addSpecialProperties( $wikiPage, $revision, $user );
 
-               $this->assertSemanticData( $semanticData, $expected );
+               $this->assertSemanticData(
+                       $semanticData,
+                       $expected,
+                       'asserts that addSpecialProperties() adds expected 
triples'
+               );
 
-               // Just verify that the Publisher was able to reach the Observer
                $this->assertTrue(
                        $this->observerStatus,
-                       'Failed asserting that the invoked Observer received a 
notification from the Publisher (Subject)'
+                       'asserts that the invoked Observer received a 
notification from the Publisher (Subject)'
                );
 
                // Check against pre-existing registered special properties
                $instance->addSpecialProperties( $wikiPage, $revision, $user );
-               $this->assertSemanticData( $semanticData, $expected );
+
+               $this->assertSemanticData(
+                       $semanticData,
+                       $expected,
+                       'asserts that addSpecialProperties() adds expected 
triples'
+               );
 
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb6e7c0b9fe68efdf0155efa92b36be4c8031394
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
Gerrit-Reviewer: Mwjames <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to