Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/61583


Change subject: Move out classes dependent on MediaWiki
......................................................................

Move out classes dependent on MediaWiki

Change-Id: I5f2f4a5f0ecbe1a732fa99050df4b73fcd63edd3
---
M DataValues/DataValues.classes.php
M DataValues/DataValues.mw.php
D DataValues/includes/values/MediaWikiTitleValue.php
D DataValues/tests/includes/values/MediaWikiTitleValueTest.php
M ValueParsers/ValueParsers.mw.php
M ValueParsers/ValueParsers.php
D ValueParsers/includes/parsers/TitleParser.php
D ValueParsers/tests/includes/parsers/TitleParserTest.php
8 files changed, 0 insertions(+), 338 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/83/61583/1

diff --git a/DataValues/DataValues.classes.php 
b/DataValues/DataValues.classes.php
index d24aa0c..25d6917 100644
--- a/DataValues/DataValues.classes.php
+++ b/DataValues/DataValues.classes.php
@@ -32,7 +32,6 @@
        'DataValues\IriValue' => 'includes/values/IriValue.php',
        'DataValues\MonolingualTextValue' => 
'includes/values/MonolingualTextValue.php',
        'DataValues\MultilingualTextValue' => 
'includes/values/MultilingualTextValue.php',
-       'DataValues\MediaWikiTitleValue' => 
'includes/values/MediaWikiTitleValue.php',
        'DataValues\NumberValue' => 'includes/values/NumberValue.php',
        'DataValues\PropertyValue' => 'includes/values/PropertyValue.php',
        'DataValues\QuantityValue' => 'includes/values/QuantityValue.php',
diff --git a/DataValues/DataValues.mw.php b/DataValues/DataValues.mw.php
index dc461a8..1eda55d 100644
--- a/DataValues/DataValues.mw.php
+++ b/DataValues/DataValues.mw.php
@@ -70,7 +70,6 @@
                'includes/values/BooleanValue',
                'includes/values/GeoCoordinateValue',
                'includes/values/IriValue',
-               'includes/values/MediaWikiTitleValue',
                'includes/values/MonolingualTextValue',
                'includes/values/MultilingualTextValue',
                'includes/values/NumberValue',
diff --git a/DataValues/includes/values/MediaWikiTitleValue.php 
b/DataValues/includes/values/MediaWikiTitleValue.php
deleted file mode 100644
index df06917..0000000
--- a/DataValues/includes/values/MediaWikiTitleValue.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-
-namespace DataValues;
-
-use InvalidArgumentException;
-use Title;
-
-/**
- * Class representing a MediaWiki title value.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @since 0.1
- *
- * @file
- * @ingroup DataValue
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < jeroended...@gmail.com >
- */
-class MediaWikiTitleValue extends DataValueObject {
-
-       /**
-        * @since 0.1
-        *
-        * @var Title
-        */
-       protected $title;
-
-       /**
-        * @since 0.1
-        *
-        * @param Title $title
-        *
-        * @throws InvalidArgumentException
-        */
-       public function __construct( Title $title ) {
-               $this->title = $title;
-       }
-
-       /**
-        * @see Serializable::serialize
-        *
-        * @since 0.1
-        *
-        * @return string
-        */
-       public function serialize() {
-               return $this->title->getFullText();
-       }
-
-       /**
-        * @see Serializable::unserialize
-        *
-        * @since 0.1
-        *
-        * @param string $value
-        *
-        * @return StringValue
-        */
-       public function unserialize( $value ) {
-               $this->__construct( Title::newFromText( $value ) );
-       }
-
-       /**
-        * @see DataValue::getType
-        *
-        * @since 0.1
-        *
-        * @return string
-        */
-       public function getType() {
-               return 'mediawikititle';
-       }
-
-       /**
-        * @see DataValue::getSortKey
-        *
-        * @since 0.1
-        *
-        * @return string|float|int
-        */
-       public function getSortKey() {
-               return $this->title->getCategorySortkey();
-       }
-
-       /**
-        * Returns the Title object.
-        * @see DataValue::getValue
-        *
-        * @since 0.1
-        *
-        * @return Title
-        */
-       public function getValue() {
-               return $this->title;
-       }
-
-       /**
-        * Constructs a new instance of the DataValue from the provided data.
-        * This can round-trip with @see getArrayValue
-        *
-        * @since 0.1
-        *
-        * @param mixed $data
-        *
-        * @return MediaWikiTitleValue
-        */
-       public static function newFromArray( $data ) {
-               return new static( $data );
-       }
-
-}
diff --git a/DataValues/tests/includes/values/MediaWikiTitleValueTest.php 
b/DataValues/tests/includes/values/MediaWikiTitleValueTest.php
deleted file mode 100644
index 239e481..0000000
--- a/DataValues/tests/includes/values/MediaWikiTitleValueTest.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-namespace DataValues\Test;
-
-use DataValues\MediaWikiTitleValue;
-
-/**
- * Tests for the DataValues\MediaWikiTitleValue class.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @since 0.1
- *
- * @ingroup DataValue
- *
- * @group DataValue
- * @group DataValueExtensions
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < jeroended...@gmail.com >
- */
-class MediaWikiTitleValueTest extends DataValueTest {
-
-       /**
-        * @see DataValueTest::getClass
-        *
-        * @since 0.1
-        *
-        * @return string
-        */
-       public function getClass() {
-               return 'DataValues\MediaWikiTitleValue';
-       }
-
-       /**
-        * @see DataValueTest::constructorProvider
-        *
-        * @since 0.1
-        *
-        * @return array
-        */
-       public function constructorProvider() {
-               $argLists = array();
-
-               $argLists[] = array( false );
-               $argLists[] = array( false, 42 );
-               $argLists[] = array( false, array() );
-               $argLists[] = array( false, false );
-               $argLists[] = array( false, true );
-               $argLists[] = array( false, null );
-               $argLists[] = array( false, 'foo' );
-               $argLists[] = array( false, '' );
-               $argLists[] = array( false, ' foo bar baz foo bar baz foo bar 
baz foo bar baz foo bar baz foo bar baz ' );
-
-               $argLists[] = array( true, \Title::newMainPage() );
-               $argLists[] = array( true, \Title::newFromText( 'Foobar' ) );
-
-               return $argLists;
-       }
-
-       /**
-        * @dataProvider instanceProvider
-        * @param \DataValues\MediaWikiTitleValue $titleValue
-        * @param array $arguments
-        */
-       public function testGetValue( MediaWikiTitleValue $titleValue, array 
$arguments ) {
-               $this->assertEquals( $arguments[0]->getFullText(), 
$titleValue->getValue()->getFullText() );
-       }
-
-}
diff --git a/ValueParsers/ValueParsers.mw.php b/ValueParsers/ValueParsers.mw.php
index 9d91a75..018ca5b 100644
--- a/ValueParsers/ValueParsers.mw.php
+++ b/ValueParsers/ValueParsers.mw.php
@@ -73,7 +73,6 @@
                'includes/parsers/FloatParser',
                'includes/parsers/IntParser',
                'includes/parsers/NullParser',
-               'includes/parsers/TitleParser',
 
                'includes/Error',
                'includes/ParserOptions',
diff --git a/ValueParsers/ValueParsers.php b/ValueParsers/ValueParsers.php
index ba2ce21..4fcf756 100644
--- a/ValueParsers/ValueParsers.php
+++ b/ValueParsers/ValueParsers.php
@@ -64,7 +64,6 @@
 $wgValueParsers['geocoordinate'] = 'ValueParsers\GeoCoordinateParser';
 $wgValueParsers['int'] = 'ValueParsers\IntParser';
 $wgValueParsers['null'] = 'ValueParsers\NullParser';
-$wgValueParsers['title'] = 'ValueParsers\TitleParser';
 
 if ( defined( 'MEDIAWIKI' ) ) {
        include __DIR__ . '/ValueParsers.mw.php';
diff --git a/ValueParsers/includes/parsers/TitleParser.php 
b/ValueParsers/includes/parsers/TitleParser.php
deleted file mode 100644
index 5af9ca3..0000000
--- a/ValueParsers/includes/parsers/TitleParser.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-namespace ValueParsers;
-
-use DataValues\MediaWikiTitleValue;
-
-/**
- * ValueParser that parses the string representation of a Title object.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @since 0.1
- *
- * @file
- * @ingroup ValueParsers
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < jeroended...@gmail.com >
- */
-class TitleParser extends StringValueParser {
-
-       /**
-        * @see StringValueParser::stringParse
-        *
-        * @since 0.1
-        *
-        * @param string $value
-        *
-        * @return MediaWikiTitleValue
-        * @throws ParseException
-        */
-       protected function stringParse( $value ) {
-               $value = \Title::newFromText( $value );
-
-               if ( is_null( $value ) ) {
-                       throw new ParseException( 'Not a title' );
-               }
-
-               return new MediaWikiTitleValue( $value );
-       }
-
-}
diff --git a/ValueParsers/tests/includes/parsers/TitleParserTest.php 
b/ValueParsers/tests/includes/parsers/TitleParserTest.php
deleted file mode 100644
index 997afdb..0000000
--- a/ValueParsers/tests/includes/parsers/TitleParserTest.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-namespace ValueParsers\Test;
-
-use DataValues\MediaWikiTitleValue;
-
-/**
- * Unit test TitleParser class.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @since 0.1
- *
- * @ingroup ValueParsersTest
- *
- * @group ValueParsers
- * @group DataValueExtensions
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < jeroended...@gmail.com >
- */
-class TitleParserTest extends StringValueParserTest {
-
-       /**
-        * @see ValueParserTestBase::validInputProvider
-        *
-        * @since 0.1
-        *
-        * @return array
-        */
-       public function validInputProvider() {
-               $argLists = array();
-
-               $valid = array(
-                       'Foo bar',
-                       'Ohi there!',
-               );
-
-               foreach ( $valid as $value ) {
-                       $argLists[] = array( $value, new MediaWikiTitleValue( 
\Title::newFromText( $value ) ) );
-               }
-
-               return $argLists;
-       }
-
-       /**
-        * @see ValueParserTestBase::getParserClass
-        * @since 0.1
-        * @return string
-        */
-       protected function getParserClass() {
-               return 'ValueParsers\TitleParser';
-       }
-
-}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f2f4a5f0ecbe1a732fa99050df4b73fcd63edd3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to