Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/254380
Change subject: Remove EntityChange::__toString ...................................................................... Remove EntityChange::__toString afaik this is unused, and if so, then best to just remove this. Change-Id: Ic2afa70e4b5525abb6bc9e05175c1f41b915b216 --- M lib/includes/changes/EntityChange.php M lib/tests/phpunit/changes/EntityChangeTest.php 2 files changed, 0 insertions(+), 49 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/80/254380/2 diff --git a/lib/includes/changes/EntityChange.php b/lib/includes/changes/EntityChange.php index abfc140..c202c0f 100644 --- a/lib/includes/changes/EntityChange.php +++ b/lib/includes/changes/EntityChange.php @@ -230,41 +230,6 @@ } /** - * Returns a human readable string representation of the change. Useful for logging and debugging. - * - * @since 0.4 - * - * @return string - */ - public function __toString() { - $string = get_class( $this ); - $string .= ': '; - - $fields = $this->getFields(); - $info = $this->hasField( 'info' ) ? $this->getField( 'info' ) : array(); - $meta = $this->getMetadata(); - - if ( is_array( $info ) ) { - $fields = array_merge( $fields, $info ); - } - - if ( is_array( $meta ) ) { - $fields = array_merge( $fields, $meta ); - } - - foreach ( $fields as $key => $value ) { - if ( is_array( $value ) || is_object( $value ) ) { - unset( $fields[$key] ); - } - } - - ksort( $fields ); - - $string .= preg_replace( '/\s+/s', ' ', var_export( $fields, true ) ); - return $string; - } - - /** * @see DiffChange::arrayalizeObjects * * Overwritten to handle Statement objects. diff --git a/lib/tests/phpunit/changes/EntityChangeTest.php b/lib/tests/phpunit/changes/EntityChangeTest.php index ce8ca1c..3a5cc64 100644 --- a/lib/tests/phpunit/changes/EntityChangeTest.php +++ b/lib/tests/phpunit/changes/EntityChangeTest.php @@ -152,20 +152,6 @@ ); } - /** - * @dataProvider changeProvider - * @since 0.4 - */ - public function testToString( EntityChange $entityChange ) { - $s = "$entityChange"; // magically calls __toString() - - $id = $entityChange->getEntityId()->getSerialization(); - $type = $entityChange->getType(); - - $this->assertTrue( stripos( $s, $id ) !== false, "missing entity ID $id" ); - $this->assertTrue( stripos( $s, $type ) !== false, "missing type $type" ); - } - public function testGetComment() { $entityChange = $this->newEntityChange( new ItemId( 'Q13' ) ); -- To view, visit https://gerrit.wikimedia.org/r/254380 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic2afa70e4b5525abb6bc9e05175c1f41b915b216 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude <aude.w...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits