Hoo man has uploaded a new change for review.
https://gerrit.wikimedia.org/r/222158
Change subject: Update Wikibase data model
......................................................................
Update Wikibase data model
Plus minor changes relating tests.
Change-Id: I15bc8a6c6f4e6cd7648f375dde5b01b8cc632359
---
M composer.lock
M extensions/Wikibase/build/travis/install.sh
M extensions/Wikibase/repo/tests/phpunit/includes/api/GetEntitiesTest.php
M vendor/composer/autoload_psr4.php
M vendor/composer/installed.json
M vendor/wikibase/data-model/.travis.yml
M vendor/wikibase/data-model/README.md
M vendor/wikibase/data-model/RELEASE-NOTES.md
M vendor/wikibase/data-model/WikibaseDataModel.php
M vendor/wikibase/data-model/src/LegacyIdInterpreter.php
M vendor/wikibase/data-model/src/Snak/SnakList.php
M vendor/wikibase/data-model/tests/unit/ByPropertyIdArrayTest.php
M vendor/wikibase/data-model/tests/unit/Claim/ClaimsTest.php
M vendor/wikibase/data-model/tests/unit/Snak/SnakListTest.php
14 files changed, 336 insertions(+), 351 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata
refs/changes/58/222158/1
diff --git a/composer.lock b/composer.lock
index 9e7629f..85c9fff 100644
--- a/composer.lock
+++ b/composer.lock
@@ -909,7 +909,7 @@
"source": {
"type": "git",
"url":
"https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQualityConstraints",
- "reference": "4d28f74a8d0076446b6071753fada9ac78ad9d29"
+ "reference": "a8ac5b55d83d5fc23eccae2bb021617381b96714"
},
"require": {
"php": ">=5.3.0",
@@ -954,20 +954,20 @@
"support": {
"issues":
"https://phabricator.wikimedia.org/project/profile/1202/"
},
- "time": "2015-06-23 22:59:54"
+ "time": "2015-07-01 11:09:28"
},
{
"name": "wikibase/data-model",
- "version": "3.0.0",
+ "version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/wmde/WikibaseDataModel.git",
- "reference": "b8c5c74a9a842836685ef317625212c391644fa8"
+ "reference": "94942755d15f814bfd0da39a33cc170154aece11"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/wmde/WikibaseDataModel/zipball/b8c5c74a9a842836685ef317625212c391644fa8",
- "reference": "b8c5c74a9a842836685ef317625212c391644fa8",
+ "url":
"https://api.github.com/repos/wmde/WikibaseDataModel/zipball/94942755d15f814bfd0da39a33cc170154aece11",
+ "reference": "94942755d15f814bfd0da39a33cc170154aece11",
"shasum": ""
},
"require": {
@@ -1014,7 +1014,7 @@
"wikibase",
"wikidata"
],
- "time": "2015-06-06 10:55:38"
+ "time": "2015-07-01 17:54:17"
},
{
"name": "wikibase/data-model-javascript",
@@ -1234,7 +1234,7 @@
"source": {
"type": "git",
"url":
"https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQuality",
- "reference": "6c877b930d068c0c11e2ee82907ca7409b6dd4ef"
+ "reference": "0e6c3c95ab49c449d35b3228691c885062f766bb"
},
"require": {
"php": ">=5.3.0",
@@ -1277,7 +1277,7 @@
"support": {
"issues":
"https://phabricator.wikimedia.org/project/profile/989/"
},
- "time": "2015-06-22 08:31:58"
+ "time": "2015-06-30 17:53:04"
},
{
"name": "wikibase/serialization-javascript",
@@ -1326,12 +1326,12 @@
"source": {
"type": "git",
"url":
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git",
- "reference": "7adfc0cb855e99249fcbc92727104c0ccb88aaa2"
+ "reference": "d4c3ef8e5f10e8fb416909eb526c7ef2053765a5"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/7adfc0cb855e99249fcbc92727104c0ccb88aaa2",
- "reference": "7adfc0cb855e99249fcbc92727104c0ccb88aaa2",
+ "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/d4c3ef8e5f10e8fb416909eb526c7ef2053765a5",
+ "reference": "d4c3ef8e5f10e8fb416909eb526c7ef2053765a5",
"shasum": ""
},
"require": {
@@ -1399,7 +1399,7 @@
"wikibaserepo",
"wikidata"
],
- "time": "2015-07-01 14:37:12"
+ "time": "2015-07-01 18:17:58"
},
{
"name": "wikibase/wikimedia-badges",
diff --git a/extensions/Wikibase/build/travis/install.sh
b/extensions/Wikibase/build/travis/install.sh
index 2ab6361..495d345 100755
--- a/extensions/Wikibase/build/travis/install.sh
+++ b/extensions/Wikibase/build/travis/install.sh
@@ -21,6 +21,7 @@
cd phase3
composer self-update
composer install
+composer dump-autoload -o # Workaround
https://github.com/wikimedia/composer-merge-plugin/issues/41
mysql -e 'create database its_a_mw;'
php maintenance/install.php --dbtype $DBTYPE --dbuser root --dbname its_a_mw
--dbpath $(pwd) --pass nyan TravisWiki admin
diff --git
a/extensions/Wikibase/repo/tests/phpunit/includes/api/GetEntitiesTest.php
b/extensions/Wikibase/repo/tests/phpunit/includes/api/GetEntitiesTest.php
index 5433a89..1ce8376 100644
--- a/extensions/Wikibase/repo/tests/phpunit/includes/api/GetEntitiesTest.php
+++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/GetEntitiesTest.php
@@ -124,12 +124,10 @@
protected static $goodFormats = array(
'json',
'php',
- 'wddx',
'xml',
'yaml',
'txt',
'dbg',
- 'dump'
);
/**
diff --git a/vendor/composer/autoload_psr4.php
b/vendor/composer/autoload_psr4.php
index f95322e..3577320 100644
--- a/vendor/composer/autoload_psr4.php
+++ b/vendor/composer/autoload_psr4.php
@@ -11,7 +11,7 @@
'Wikidata\\' => array($baseDir . '/src'),
'Wikibase\\View\\' => array($baseDir . '/extensions/Wikibase/view/src'),
'Wikibase\\InternalSerialization\\' => array($vendorDir .
'/wikibase/internal-serialization/src'),
- 'Wikibase\\DataModel\\' => array($vendorDir . '/wikibase/data-model/src',
$vendorDir . '/wikibase/data-model-serialization/src'),
+ 'Wikibase\\DataModel\\' => array($vendorDir .
'/wikibase/data-model-serialization/src', $vendorDir .
'/wikibase/data-model/src'),
'WikibaseQuality\\Tests\\' => array($baseDir .
'/extensions/Quality/tests/phpunit'),
'WikibaseQuality\\Specials\\' => array($baseDir .
'/extensions/Quality/specials'),
'WikibaseQuality\\ConstraintReport\\Tests\\' => array($baseDir .
'/extensions/Constraints/tests/phpunit'),
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 33001da..31c33c2 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -515,68 +515,6 @@
]
},
{
- "name": "wikibase/data-model",
- "version": "3.0.0",
- "version_normalized": "3.0.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/wmde/WikibaseDataModel.git",
- "reference": "b8c5c74a9a842836685ef317625212c391644fa8"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/wmde/WikibaseDataModel/zipball/b8c5c74a9a842836685ef317625212c391644fa8",
- "reference": "b8c5c74a9a842836685ef317625212c391644fa8",
- "shasum": ""
- },
- "require": {
- "data-values/data-values": "~0.1|~1.0",
- "diff/diff": "~1.0|~2.0",
- "php": ">=5.3.0"
- },
- "require-dev": {
- "phpmd/phpmd": "~2.1",
- "squizlabs/php_codesniffer": "~2.1"
- },
- "time": "2015-06-06 10:55:38",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.0.x-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "files": [
- "WikibaseDataModel.php"
- ],
- "psr-4": {
- "Wikibase\\DataModel\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "GPL-2.0+"
- ],
- "authors": [
- {
- "name": "Thiemo Mättig"
- },
- {
- "name": "Jeroen De Dauw",
- "email": "[email protected]",
- "homepage": "http://jeroendedauw.com"
- }
- ],
- "description": "PHP implementation of the Wikibase DataModel",
- "homepage": "https://github.com/wmde/WikibaseDataModel",
- "keywords": [
- "DataModel",
- "wikibase",
- "wikidata"
- ]
- },
- {
"name": "wikibase/data-model-serialization",
"version": "1.4.0",
"version_normalized": "1.4.0.0",
@@ -1306,13 +1244,158 @@
}
},
{
+ "name": "wikibase/data-model",
+ "version": "3.0.1",
+ "version_normalized": "3.0.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/wmde/WikibaseDataModel.git",
+ "reference": "94942755d15f814bfd0da39a33cc170154aece11"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/wmde/WikibaseDataModel/zipball/94942755d15f814bfd0da39a33cc170154aece11",
+ "reference": "94942755d15f814bfd0da39a33cc170154aece11",
+ "shasum": ""
+ },
+ "require": {
+ "data-values/data-values": "~0.1|~1.0",
+ "diff/diff": "~1.0|~2.0",
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "phpmd/phpmd": "~2.1",
+ "squizlabs/php_codesniffer": "~2.1"
+ },
+ "time": "2015-07-01 17:54:17",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0.x-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "files": [
+ "WikibaseDataModel.php"
+ ],
+ "psr-4": {
+ "Wikibase\\DataModel\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0+"
+ ],
+ "authors": [
+ {
+ "name": "Thiemo Mättig"
+ },
+ {
+ "name": "Jeroen De Dauw",
+ "email": "[email protected]",
+ "homepage": "http://jeroendedauw.com"
+ }
+ ],
+ "description": "PHP implementation of the Wikibase DataModel",
+ "homepage": "https://github.com/wmde/WikibaseDataModel",
+ "keywords": [
+ "DataModel",
+ "wikibase",
+ "wikidata"
+ ]
+ },
+ {
+ "name": "wikibase/wikibase",
+ "version": "dev-wmf/1.26wmf12",
+ "version_normalized": "dev-wmf/1.26wmf12",
+ "source": {
+ "type": "git",
+ "url":
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git",
+ "reference": "d4c3ef8e5f10e8fb416909eb526c7ef2053765a5"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/d4c3ef8e5f10e8fb416909eb526c7ef2053765a5",
+ "reference": "d4c3ef8e5f10e8fb416909eb526c7ef2053765a5",
+ "shasum": ""
+ },
+ "require": {
+ "data-values/common": "~0.2.0",
+ "data-values/data-types": "~0.4.0",
+ "data-values/data-values": "~1.0.0",
+ "data-values/geo": "~1.0",
+ "data-values/interfaces": "^0.1.5",
+ "data-values/javascript": "~0.6.0|~0.7.0",
+ "data-values/number": "~0.5.0",
+ "data-values/serialization": "~1.0",
+ "data-values/time": "~0.8.0",
+ "data-values/validators": "~0.1.0",
+ "data-values/value-view": "~0.14.0",
+ "diff/diff": "~2.0|~1.0",
+ "php": ">=5.3.2",
+ "wikibase/data-model": "~3.0",
+ "wikibase/data-model-javascript": "^1.0.2",
+ "wikibase/data-model-serialization": "~1.4",
+ "wikibase/internal-serialization": "~1.4",
+ "wikibase/javascript-api": "~1.0",
+ "wikibase/serialization-javascript": "~2.0"
+ },
+ "conflict": {
+ "mediawiki/mediawiki": "<1.23"
+ },
+ "require-dev": {
+ "squizlabs/php_codesniffer": "~2.1"
+ },
+ "time": "2015-07-01 18:17:58",
+ "type": "mediawiki-extension",
+ "installation-source": "dist",
+ "autoload": {
+ "classmap": [
+ "client/includes/",
+ "client/WikibaseClient.hooks.php",
+ "client/tests/phpunit/",
+ "lib/includes/",
+ "lib/WikibaseLib.hooks.php",
+ "lib/tests/phpunit/",
+ "repo/includes/",
+ "repo/maintenance/",
+ "repo/tests/phpunit/",
+ "repo/Wikibase.hooks.php"
+ ],
+ "psr-4": {
+ "Wikibase\\View\\": "view/src",
+ "Wikimedia\\Purtle\\": "purtle/src",
+ "Wikimedia\\Purtle\\Tests\\": "purtle/tests/phpunit"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0+"
+ ],
+ "authors": [
+ {
+ "name": "The Wikidata team"
+ }
+ ],
+ "description": "Structured data repository for MediaWiki",
+ "homepage": "http://wikiba.se",
+ "keywords": [
+ "wikibase",
+ "wikibaseclient",
+ "wikibaselib",
+ "wikibaserepo",
+ "wikidata"
+ ]
+ },
+ {
"name": "wikibase/quality",
"version": "1.x-dev",
"version_normalized": "1.9999999.9999999.9999999-dev",
"source": {
"type": "git",
"url":
"https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQuality",
- "reference": "6c877b930d068c0c11e2ee82907ca7409b6dd4ef"
+ "reference": "0e6c3c95ab49c449d35b3228691c885062f766bb"
},
"require": {
"php": ">=5.3.0",
@@ -1323,7 +1406,7 @@
"phpunit/phpunit": "~3.7,>=3.7.37|~4.5",
"satooshi/php-coveralls": "master-dev"
},
- "time": "2015-06-22 08:31:58",
+ "time": "2015-06-30 13:02:17",
"type": "mediawiki-extension",
"installation-source": "source",
"autoload": {
@@ -1365,7 +1448,7 @@
"source": {
"type": "git",
"url":
"https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQualityConstraints",
- "reference": "4d28f74a8d0076446b6071753fada9ac78ad9d29"
+ "reference": "a8ac5b55d83d5fc23eccae2bb021617381b96714"
},
"require": {
"php": ">=5.3.0",
@@ -1376,7 +1459,7 @@
"phpunit/phpunit": "~3.7,>=3.7.37|~4.5",
"satooshi/php-coveralls": "master-dev"
},
- "time": "2015-06-23 22:13:00",
+ "time": "2015-07-01 11:09:28",
"type": "mediawiki-extension",
"installation-source": "source",
"autoload": {
@@ -1412,88 +1495,5 @@
"support": {
"issues": "https://phabricator.wikimedia.org/project/profile/1202/"
}
- },
- {
- "name": "wikibase/wikibase",
- "version": "dev-wmf/1.26wmf12",
- "version_normalized": "dev-wmf/1.26wmf12",
- "source": {
- "type": "git",
- "url":
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git",
- "reference": "7adfc0cb855e99249fcbc92727104c0ccb88aaa2"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/7adfc0cb855e99249fcbc92727104c0ccb88aaa2",
- "reference": "7adfc0cb855e99249fcbc92727104c0ccb88aaa2",
- "shasum": ""
- },
- "require": {
- "data-values/common": "~0.2.0",
- "data-values/data-types": "~0.4.0",
- "data-values/data-values": "~1.0.0",
- "data-values/geo": "~1.0",
- "data-values/interfaces": "^0.1.5",
- "data-values/javascript": "~0.6.0|~0.7.0",
- "data-values/number": "~0.5.0",
- "data-values/serialization": "~1.0",
- "data-values/time": "~0.8.0",
- "data-values/validators": "~0.1.0",
- "data-values/value-view": "~0.14.0",
- "diff/diff": "~2.0|~1.0",
- "php": ">=5.3.2",
- "wikibase/data-model": "~3.0",
- "wikibase/data-model-javascript": "^1.0.2",
- "wikibase/data-model-serialization": "~1.4",
- "wikibase/internal-serialization": "~1.4",
- "wikibase/javascript-api": "~1.0",
- "wikibase/serialization-javascript": "~2.0"
- },
- "conflict": {
- "mediawiki/mediawiki": "<1.23"
- },
- "require-dev": {
- "squizlabs/php_codesniffer": "~2.1"
- },
- "time": "2015-07-01 14:37:12",
- "type": "mediawiki-extension",
- "installation-source": "dist",
- "autoload": {
- "classmap": [
- "client/includes/",
- "client/WikibaseClient.hooks.php",
- "client/tests/phpunit/",
- "lib/includes/",
- "lib/WikibaseLib.hooks.php",
- "lib/tests/phpunit/",
- "repo/includes/",
- "repo/maintenance/",
- "repo/tests/phpunit/",
- "repo/Wikibase.hooks.php"
- ],
- "psr-4": {
- "Wikibase\\View\\": "view/src",
- "Wikimedia\\Purtle\\": "purtle/src",
- "Wikimedia\\Purtle\\Tests\\": "purtle/tests/phpunit"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "GPL-2.0+"
- ],
- "authors": [
- {
- "name": "The Wikidata team"
- }
- ],
- "description": "Structured data repository for MediaWiki",
- "homepage": "http://wikiba.se",
- "keywords": [
- "wikibase",
- "wikibaseclient",
- "wikibaselib",
- "wikibaserepo",
- "wikidata"
- ]
}
]
diff --git a/vendor/wikibase/data-model/.travis.yml
b/vendor/wikibase/data-model/.travis.yml
index 816d74c..0d01fa9 100644
--- a/vendor/wikibase/data-model/.travis.yml
+++ b/vendor/wikibase/data-model/.travis.yml
@@ -7,11 +7,6 @@
- 5.6
- 7
- hhvm
- - hhvm-nightly
-
-matrix:
- allow_failures:
- - php: hhvm-nightly
sudo: false
@@ -22,7 +17,7 @@
notifications:
irc:
channels:
- - "chat.freenode.net#wikidata"
+ - "chat.freenode.net#wikidata-feed"
on_success: change
on_failure: always
template:
diff --git a/vendor/wikibase/data-model/README.md
b/vendor/wikibase/data-model/README.md
index c610884..f924757 100644
--- a/vendor/wikibase/data-model/README.md
+++ b/vendor/wikibase/data-model/README.md
@@ -55,9 +55,11 @@
## Tests
-This library comes with a set up PHPUnit tests that cover all non-trivial
code. You can run these
-tests using the PHPUnit configuration file found in the root directory. The
tests can also be run
-via TravisCI, as a TravisCI configuration file is also provided in the root
directory.
+This library comes with a set up PHPUnit tests that cover all non-trivial
code. Additionally, code
+style checks by PHPCS and PHPMD are supported. The configuration for all 3
these tools can be found
+in the root directory. You can use the tools in their standard manner, though
can run all checks
+required by our CI by executing `composer ci`. To just run tests use `composer
test`, and to just
+run style checks use `composer cs`.
## Credits
@@ -87,6 +89,7 @@
## See also
* [Blog posts on Wikibase
DataModel](http://www.bn2vs.com/blog/tag/wikibase-datamodel/)
+* [Wikibase DataModel
Services](https://github.com/wmde/WikibaseDataModelServices)
* [Wikibase DataModel
Serialization](https://github.com/wmde/WikibaseDataModelSerialization)
* [Wikibase Internal
Serialization](https://github.com/wmde/WikibaseInternalSerialization)
diff --git a/vendor/wikibase/data-model/RELEASE-NOTES.md
b/vendor/wikibase/data-model/RELEASE-NOTES.md
index 85b90cd..1098710 100644
--- a/vendor/wikibase/data-model/RELEASE-NOTES.md
+++ b/vendor/wikibase/data-model/RELEASE-NOTES.md
@@ -1,6 +1,9 @@
# Wikibase DataModel release notes
-## Version 3.0.0 (2015-06-04)
+## Version 3.0.1 (2015-07-01)
+* Fixed out of bounds bug in `SnakList::orderByProperty`
+
+## Version 3.0.0 (2015-06-06)
#### Breaking changes
@@ -183,7 +186,6 @@
* Changed the constructor signature of `Property`
* Removed `Entity::setClaims` (`Item::setClaims` has been retained)
* Removed `Entity::stub`
-* Removed `Property::newEmpty`
* Removed `Entity::getIdFromClaimGuid`
* `Entity::removeLabel` no longer accepts an array of language codes
* `Entity::removeDescription` no longer accepts an array of language codes
@@ -371,7 +373,7 @@
#### Deprecations
-* Deprecated `Property::newEmpty`
+* Deprecated `Property::newEmpty` in favor of `Property::newFromType`
* Deprecated old fingerprint related methods in `Entity`:
* setLabel
* setDescription
diff --git a/vendor/wikibase/data-model/WikibaseDataModel.php
b/vendor/wikibase/data-model/WikibaseDataModel.php
index 044ff62..84784e4 100644
--- a/vendor/wikibase/data-model/WikibaseDataModel.php
+++ b/vendor/wikibase/data-model/WikibaseDataModel.php
@@ -12,7 +12,7 @@
return 1;
}
-define( 'WIKIBASE_DATAMODEL_VERSION', '3.0.0' );
+define( 'WIKIBASE_DATAMODEL_VERSION', '3.0.1' );
if ( defined( 'MEDIAWIKI' ) ) {
call_user_func( function() {
diff --git a/vendor/wikibase/data-model/src/LegacyIdInterpreter.php
b/vendor/wikibase/data-model/src/LegacyIdInterpreter.php
index 58f3880..12b5428 100644
--- a/vendor/wikibase/data-model/src/LegacyIdInterpreter.php
+++ b/vendor/wikibase/data-model/src/LegacyIdInterpreter.php
@@ -17,7 +17,7 @@
* @since 1.0
*
* @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected]
+ * @author Jeroen De Dauw < [email protected] >
*/
class LegacyIdInterpreter {
diff --git a/vendor/wikibase/data-model/src/Snak/SnakList.php
b/vendor/wikibase/data-model/src/Snak/SnakList.php
index cc6bfaf..ac4547d 100644
--- a/vendor/wikibase/data-model/src/Snak/SnakList.php
+++ b/vendor/wikibase/data-model/src/Snak/SnakList.php
@@ -126,16 +126,18 @@
$orderedProperties = array_unique( array_merge( $order,
array_keys( $snaksByProperty ) ) );
foreach ( $orderedProperties as $property ) {
- $snaks = $snaksByProperty[$property];
- $this->moveSnaksToBottom( $snaks );
+ if ( array_key_exists( $property, $snaksByProperty ) ) {
+ $snaks = $snaksByProperty[$property];
+ $this->moveSnaksToBottom( $snaks );
+ }
}
}
/**
- * @param array $snaks to remove and re add
+ * @param Snak[] $snaks to remove and re add
*/
- private function moveSnaksToBottom( $snaks ) {
- foreach( $snaks as $snak ) {
+ private function moveSnaksToBottom( array $snaks ) {
+ foreach ( $snaks as $snak ) {
$this->removeSnak( $snak );
$this->addSnak( $snak );
}
@@ -145,15 +147,15 @@
* Gets the snaks in the current object in an array
* grouped by property id
*
- * @return array
+ * @return array[]
*/
private function getSnaksByProperty() {
$snaksByProperty = array();
- foreach( $this as $snak ) {
+ foreach ( $this as $snak ) {
/** @var Snak $snak */
$propertyId =
$snak->getPropertyId()->getSerialization();
- if( !isset( $snaksByProperty[$propertyId] ) ) {
+ if ( !isset( $snaksByProperty[$propertyId] ) ) {
$snaksByProperty[$propertyId] = array();
}
$snaksByProperty[$propertyId][] = $snak;
diff --git a/vendor/wikibase/data-model/tests/unit/ByPropertyIdArrayTest.php
b/vendor/wikibase/data-model/tests/unit/ByPropertyIdArrayTest.php
index eec9601..092f360 100644
--- a/vendor/wikibase/data-model/tests/unit/ByPropertyIdArrayTest.php
+++ b/vendor/wikibase/data-model/tests/unit/ByPropertyIdArrayTest.php
@@ -6,7 +6,6 @@
use ReflectionClass;
use ReflectionMethod;
use Wikibase\DataModel\ByPropertyIdArray;
-use Wikibase\DataModel\Claim\Claim;
use Wikibase\DataModel\Claim\Claims;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Snak\PropertyNoValueSnak;
@@ -29,18 +28,18 @@
class ByPropertyIdArrayTest extends \PHPUnit_Framework_TestCase {
public function testArrayObjectNotConstructedFromObject() {
- $claim1 = new Claim( new PropertyNoValueSnak( 1 ) );
- $claim1->setGuid( '1' );
- $claim2 = new Claim( new PropertyNoValueSnak( 2 ) );
- $claim2->setGuid( '2' );
+ $statement1 = new Statement( new PropertyNoValueSnak( 1 ) );
+ $statement1->setGuid( '1' );
+ $statement2 = new Statement( new PropertyNoValueSnak( 2 ) );
+ $statement2->setGuid( '2' );
$claims = new Claims();
- $claims->append( $claim1 );
+ $claims->append( $statement1 );
$byPropertyIdArray = new ByPropertyIdArray( $claims );
// According to the documentation append() "cannot be called
when the ArrayObject was
// constructed from an object." This test makes sure it was not
constructed from an object.
- $byPropertyIdArray->append( $claim2 );
+ $byPropertyIdArray->append( $statement2 );
$this->assertCount( 2, $byPropertyIdArray );
}
@@ -73,13 +72,6 @@
$lists[] = array_map(
function( Snak $snak ) {
- return new Claim( $snak );
- },
- $snaks
- );
-
- $lists[] = array_map(
- function( Snak $snak ) {
return new Statement( $snak );
},
$snaks
@@ -95,9 +87,9 @@
}
/**
- * @return Claim[]
+ * @return Statement[]
*/
- protected function claimsProvider() {
+ protected function statementsProvider() {
$snaks = array(
new PropertyNoValueSnak( new PropertyId( 'P1' ) ),
new PropertySomeValueSnak( new PropertyId( 'P1' ) ),
@@ -109,7 +101,7 @@
return array_map(
function( Snak $snak ) {
- return new Claim( $snak );
+ return new Statement( $snak );
},
$snaks
);
@@ -247,7 +239,7 @@
}
public function moveProvider() {
- $c = $this->claimsProvider();
+ $c = $this->statementsProvider();
$argLists = array();
$argLists[] = array( $c, $c[0], 0, $c );
@@ -330,27 +322,27 @@
}
public function
testMoveThrowingOutOfBoundsExceptionIfObjectNotPresent() {
- $claims = $this->claimsProvider();
- $indexedArray = new ByPropertyIdArray( $claims );
+ $statements = $this->statementsProvider();
+ $indexedArray = new ByPropertyIdArray( $statements );
$indexedArray->buildIndex();
$this->setExpectedException( 'OutOfBoundsException' );
- $indexedArray->moveObjectToIndex( new Claim( new
PropertyNoValueSnak( new PropertyId( 'P9999' ) ) ), 0 );
+ $indexedArray->moveObjectToIndex( new Statement( new
PropertyNoValueSnak( new PropertyId( 'P9999' ) ) ), 0 );
}
public function testMoveThrowingOutOfBoundsExceptionOnInvalidIndex() {
- $claims = $this->claimsProvider();
- $indexedArray = new ByPropertyIdArray( $claims );
+ $statements = $this->statementsProvider();
+ $indexedArray = new ByPropertyIdArray( $statements );
$indexedArray->buildIndex();
$this->setExpectedException( 'OutOfBoundsException' );
- $indexedArray->moveObjectToIndex( $claims[0], 9999 );
+ $indexedArray->moveObjectToIndex( $statements[0], 9999 );
}
public function addProvider() {
- $c = $this->claimsProvider();
+ $c = $this->statementsProvider();
$argLists = array();
diff --git a/vendor/wikibase/data-model/tests/unit/Claim/ClaimsTest.php
b/vendor/wikibase/data-model/tests/unit/Claim/ClaimsTest.php
index cd2338a..ab5c8dd 100644
--- a/vendor/wikibase/data-model/tests/unit/Claim/ClaimsTest.php
+++ b/vendor/wikibase/data-model/tests/unit/Claim/ClaimsTest.php
@@ -4,7 +4,6 @@
use InvalidArgumentException;
use ReflectionClass;
-use Wikibase\DataModel\Claim\Claim;
use Wikibase\DataModel\Claim\Claims;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Snak\PropertyNoValueSnak;
@@ -27,21 +26,9 @@
*/
class ClaimsTest extends \PHPUnit_Framework_TestCase {
- protected $guidCounter = 0;
+ private $guidCounter = 0;
- protected function makeClaim( Snak $mainSnak, $guid = null ) {
- if ( $guid === null ) {
- $this->guidCounter++;
- $guid = 'TEST$claim-' . $this->guidCounter;
- }
-
- $claim = new Claim( $mainSnak );
- $claim->setGuid( $guid );
-
- return $claim;
- }
-
- protected function makeStatement( Snak $mainSnak, $guid = null ) {
+ private function makeStatement( Snak $mainSnak, $guid = null ) {
if ( $guid === null ) {
$this->guidCounter++;
$guid = 'TEST$statement-' . $this->guidCounter;
@@ -87,103 +74,103 @@
public function testHasClaimWithGuid() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $this->assertFalse( $claims->hasClaimWithGuid(
$claim1->getGuid() ) );
- $this->assertFalse( $claims->hasClaimWithGuid(
$claim2->getGuid() ) );
+ $this->assertFalse( $claims->hasClaimWithGuid(
$statement1->getGuid() ) );
+ $this->assertFalse( $claims->hasClaimWithGuid(
$statement2->getGuid() ) );
- $claims->addClaim( $claim1 );
- $this->assertTrue( $claims->hasClaimWithGuid(
$claim1->getGuid() ) );
- $this->assertFalse( $claims->hasClaimWithGuid(
$claim2->getGuid() ) );
+ $claims->addClaim( $statement1 );
+ $this->assertTrue( $claims->hasClaimWithGuid(
$statement1->getGuid() ) );
+ $this->assertFalse( $claims->hasClaimWithGuid(
$statement2->getGuid() ) );
- $claims->addClaim( $claim2 );
- $this->assertTrue( $claims->hasClaimWithGuid(
$claim1->getGuid() ) );
- $this->assertTrue( $claims->hasClaimWithGuid(
$claim2->getGuid() ) );
+ $claims->addClaim( $statement2 );
+ $this->assertTrue( $claims->hasClaimWithGuid(
$statement1->getGuid() ) );
+ $this->assertTrue( $claims->hasClaimWithGuid(
$statement2->getGuid() ) );
}
public function testRemoveClaimWithGuid() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims->addClaim( $claim1 );
- $claims->addClaim( $claim2 );
+ $claims->addClaim( $statement1 );
+ $claims->addClaim( $statement2 );
$this->assertSame( 2, $claims->count() );
- $claims->removeClaimWithGuid( $claim1->getGuid() );
+ $claims->removeClaimWithGuid( $statement1->getGuid() );
$this->assertSame( 1, $claims->count() );
- $claims->removeClaimWithGuid( $claim2->getGuid() );
+ $claims->removeClaimWithGuid( $statement2->getGuid() );
$this->assertSame( 0, $claims->count() );
}
public function testOffsetUnset() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims->addClaim( $claim1 );
- $claims->addClaim( $claim2 );
+ $claims->addClaim( $statement1 );
+ $claims->addClaim( $statement2 );
$this->assertSame( 2, $claims->count() );
- $claims->offsetUnset( $claim1->getGuid() );
+ $claims->offsetUnset( $statement1->getGuid() );
$this->assertSame( 1, $claims->count() );
- $claims->offsetUnset( $claim2->getGuid() );
+ $claims->offsetUnset( $statement2->getGuid() );
$this->assertSame( 0, $claims->count() );
}
public function testGetClaimWithGuid() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims->addClaim( $claim1 );
- $this->assertSame( $claim1, $claims->getClaimWithGuid(
$claim1->getGuid() ) );
- $this->assertNull( $claims->getClaimWithGuid(
$claim2->getGuid() ) );
+ $claims->addClaim( $statement1 );
+ $this->assertSame( $statement1, $claims->getClaimWithGuid(
$statement1->getGuid() ) );
+ $this->assertNull( $claims->getClaimWithGuid(
$statement2->getGuid() ) );
- $claims->addClaim( $claim2 );
- $this->assertSame( $claim1, $claims->getClaimWithGuid(
$claim1->getGuid() ) );
- $this->assertSame( $claim2, $claims->getClaimWithGuid(
$claim2->getGuid() ) );
+ $claims->addClaim( $statement2 );
+ $this->assertSame( $statement1, $claims->getClaimWithGuid(
$statement1->getGuid() ) );
+ $this->assertSame( $statement2, $claims->getClaimWithGuid(
$statement2->getGuid() ) );
}
public function testOffsetGet() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims->addClaim( $claim1 );
- $this->assertSame( $claim1, $claims->offsetGet(
$claim1->getGuid() ) );
+ $claims->addClaim( $statement1 );
+ $this->assertSame( $statement1, $claims->offsetGet(
$statement1->getGuid() ) );
- $claims->addClaim( $claim2 );
- $this->assertSame( $claim1, $claims->offsetGet(
$claim1->getGuid() ) );
- $this->assertSame( $claim2, $claims->offsetGet(
$claim2->getGuid() ) );
+ $claims->addClaim( $statement2 );
+ $this->assertSame( $statement1, $claims->offsetGet(
$statement1->getGuid() ) );
+ $this->assertSame( $statement2, $claims->offsetGet(
$statement2->getGuid() ) );
}
public function testAddClaim() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims->addClaim( $claim1 );
- $claims->addClaim( $claim2 );
+ $claims->addClaim( $statement1 );
+ $claims->addClaim( $statement2 );
$this->assertSame( 2, $claims->count() );
- $this->assertEquals( $claim1, $claims[$claim1->getGuid()] );
- $this->assertEquals( $claim2, $claims[$claim2->getGuid()] );
+ $this->assertEquals( $statement1,
$claims[$statement1->getGuid()] );
+ $this->assertEquals( $statement2,
$claims[$statement2->getGuid()] );
- $claims->addClaim( $claim1 );
- $claims->addClaim( $claim2 );
+ $claims->addClaim( $statement1 );
+ $claims->addClaim( $statement2 );
$this->assertSame( 2, $claims->count() );
- $this->assertNotNull( $claims->getClaimWithGuid(
$claim1->getGuid() ) );
- $this->assertNotNull( $claims->getClaimWithGuid(
$claim2->getGuid() ) );
+ $this->assertNotNull( $claims->getClaimWithGuid(
$statement1->getGuid() ) );
+ $this->assertNotNull( $claims->getClaimWithGuid(
$statement2->getGuid() ) );
$this->assertSame( array(
- 'TEST$CLAIM-1' => $claim1,
- 'TEST$CLAIM-2' => $claim2,
+ 'TEST$STATEMENT-1' => $statement1,
+ 'TEST$STATEMENT-2' => $statement2,
), $claims->getArrayCopy() );
}
@@ -192,42 +179,42 @@
*/
public function testAddClaimWithIndexFails() {
$claims = new Claims();
- $claim = new Claim( new PropertyNoValueSnak( 42 ) );
- $claims->addClaim( $claim, 0 );
+ $statement = new Statement( new PropertyNoValueSnak( 42 ) );
+ $claims->addClaim( $statement, 0 );
}
public function testAppend() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims->append( $claim1 );
- $claims->append( $claim2 );
+ $claims->append( $statement1 );
+ $claims->append( $statement2 );
$this->assertSame( 2, $claims->count() );
- $this->assertEquals( $claim1, $claims[$claim1->getGuid()] );
- $this->assertEquals( $claim2, $claims[$claim2->getGuid()] );
+ $this->assertEquals( $statement1,
$claims[$statement1->getGuid()] );
+ $this->assertEquals( $statement2,
$claims[$statement2->getGuid()] );
- $claims->append( $claim1 );
- $claims->append( $claim2 );
+ $claims->append( $statement1 );
+ $claims->append( $statement2 );
$this->assertSame( 2, $claims->count() );
}
public function testAppendOperator() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims[] = $claim1;
- $claims[] = $claim2;
+ $claims[] = $statement1;
+ $claims[] = $statement2;
$this->assertSame( 2, $claims->count() );
- $this->assertEquals( $claim1, $claims[$claim1->getGuid()] );
- $this->assertEquals( $claim2, $claims[$claim2->getGuid()] );
+ $this->assertEquals( $statement1,
$claims[$statement1->getGuid()] );
+ $this->assertEquals( $statement2,
$claims[$statement2->getGuid()] );
- $claims[] = $claim1;
- $claims[] = $claim2;
+ $claims[] = $statement1;
+ $claims[] = $statement2;
$this->assertSame( 2, $claims->count() );
}
@@ -242,109 +229,109 @@
public function testOffsetSet() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims->offsetSet( $claim1->getGuid(), $claim1 );
- $claims->offsetSet( $claim2->getGuid(), $claim2 );
+ $claims->offsetSet( $statement1->getGuid(), $statement1 );
+ $claims->offsetSet( $statement2->getGuid(), $statement2 );
$this->assertSame( 2, $claims->count() );
- $this->assertEquals( $claim1, $claims[$claim1->getGuid()] );
- $this->assertEquals( $claim2, $claims[$claim2->getGuid()] );
+ $this->assertEquals( $statement1,
$claims[$statement1->getGuid()] );
+ $this->assertEquals( $statement2,
$claims[$statement2->getGuid()] );
- $claims->offsetSet( $claim1->getGuid(), $claim1 );
- $claims->offsetSet( $claim2->getGuid(), $claim2 );
+ $claims->offsetSet( $statement1->getGuid(), $statement1 );
+ $claims->offsetSet( $statement2->getGuid(), $statement2 );
$this->assertSame( 2, $claims->count() );
$this->setExpectedException( 'InvalidArgumentException' );
- $claims->offsetSet( 'spam', $claim1 );
+ $claims->offsetSet( 'spam', $statement1 );
}
public function testOffsetSetOperator() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claims[$claim1->getGuid()] = $claim1;
- $claims[$claim2->getGuid()] = $claim2;
+ $claims[$statement1->getGuid()] = $statement1;
+ $claims[$statement2->getGuid()] = $statement2;
$this->assertSame( 2, $claims->count() );
- $this->assertEquals( $claim1, $claims[$claim1->getGuid()] );
- $this->assertEquals( $claim2, $claims[$claim2->getGuid()] );
+ $this->assertEquals( $statement1,
$claims[$statement1->getGuid()] );
+ $this->assertEquals( $statement2,
$claims[$statement2->getGuid()] );
- $claims[$claim1->getGuid()] = $claim1;
- $claims[$claim2->getGuid()] = $claim2;
+ $claims[$statement1->getGuid()] = $statement1;
+ $claims[$statement2->getGuid()] = $statement2;
$this->assertSame( 2, $claims->count() );
}
public function testGuidNormalization() {
$claims = new Claims();
- $claim1 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P15' ) ) );
- $claim2 = $this->makeClaim( new PropertyNoValueSnak( new
PropertyId( 'P16' ) ) );
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P15' ) ) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak(
new PropertyId( 'P16' ) ) );
- $claim1LowerGuid = strtolower( $claim1->getGuid() );
- $claim2UpperGuid = strtoupper( $claim2->getGuid() );
+ $claim1LowerGuid = strtolower( $statement1->getGuid() );
+ $claim2UpperGuid = strtoupper( $statement2->getGuid() );
- $claims->addClaim( $claim1 );
- $claims->addClaim( $claim2 );
+ $claims->addClaim( $statement1 );
+ $claims->addClaim( $statement2 );
$this->assertSame( 2, $claims->count() );
- $this->assertEquals( $claim1, $claims->getClaimWithGuid(
$claim1LowerGuid ) );
- $this->assertEquals( $claim2, $claims->getClaimWithGuid(
$claim2UpperGuid ) );
+ $this->assertEquals( $statement1, $claims->getClaimWithGuid(
$claim1LowerGuid ) );
+ $this->assertEquals( $statement2, $claims->getClaimWithGuid(
$claim2UpperGuid ) );
- $this->assertEquals( $claim1, $claims->offsetGet(
$claim1LowerGuid ) );
- $this->assertEquals( $claim2, $claims->offsetGet(
$claim2UpperGuid ) );
+ $this->assertEquals( $statement1, $claims->offsetGet(
$claim1LowerGuid ) );
+ $this->assertEquals( $statement2, $claims->offsetGet(
$claim2UpperGuid ) );
- $this->assertEquals( $claim1, $claims[$claim1LowerGuid] );
- $this->assertEquals( $claim2, $claims[$claim2UpperGuid] );
+ $this->assertEquals( $statement1, $claims[$claim1LowerGuid] );
+ $this->assertEquals( $statement2, $claims[$claim2UpperGuid] );
$claims = new Claims();
- $claims->offsetSet( strtoupper( $claim1LowerGuid ), $claim1 );
- $claims->offsetSet( strtolower( $claim2UpperGuid ), $claim2 );
+ $claims->offsetSet( strtoupper( $claim1LowerGuid ), $statement1
);
+ $claims->offsetSet( strtolower( $claim2UpperGuid ), $statement2
);
$this->assertSame( 2, $claims->count() );
- $this->assertEquals( $claim1, $claims->getClaimWithGuid(
$claim1LowerGuid ) );
- $this->assertEquals( $claim2, $claims->getClaimWithGuid(
$claim2UpperGuid ) );
+ $this->assertEquals( $statement1, $claims->getClaimWithGuid(
$claim1LowerGuid ) );
+ $this->assertEquals( $statement2, $claims->getClaimWithGuid(
$claim2UpperGuid ) );
}
/**
* Attempts to add Claims with no GUID set will fail.
*/
public function testNoGuidFailure() {
- $claim = new Claim( new PropertyNoValueSnak( 42 ) );
+ $statement = new Statement( new PropertyNoValueSnak( 42 ) );
$list = new Claims();
$this->setExpectedException( 'InvalidArgumentException' );
- $list->addClaim( $claim );
+ $list->addClaim( $statement );
}
public function testDuplicateClaims() {
- $firstClaim = $this->makeClaim( new PropertyNoValueSnak( 42 ) );
- $secondClaim = $this->makeClaim( new PropertyNoValueSnak( 42 )
);
+ $statement1 = $this->makeStatement( new PropertyNoValueSnak( 42
) );
+ $statement2 = $this->makeStatement( new PropertyNoValueSnak( 42
) );
$list = new Claims();
- $list->addClaim( $firstClaim );
- $list->addClaim( $secondClaim );
+ $list->addClaim( $statement1 );
+ $list->addClaim( $statement2 );
$this->assertEquals( 2, $list->count(), 'Adding two duplicates
to an empty list should result in a count of two' );
- $this->assertEquals( $firstClaim, $list->getClaimWithGuid(
$firstClaim->getGuid() ) );
- $this->assertEquals( $secondClaim, $list->getClaimWithGuid(
$secondClaim->getGuid() ) );
+ $this->assertEquals( $statement1, $list->getClaimWithGuid(
$statement1->getGuid() ) );
+ $this->assertEquals( $statement2, $list->getClaimWithGuid(
$statement2->getGuid() ) );
- $list->removeClaimWithGuid( $secondClaim->getGuid() );
+ $list->removeClaimWithGuid( $statement2->getGuid() );
- $this->assertNotNull( $list->getClaimWithGuid(
$firstClaim->getGuid() ) );
- $this->assertNull( $list->getClaimWithGuid(
$secondClaim->getGuid() ) );
+ $this->assertNotNull( $list->getClaimWithGuid(
$statement1->getGuid() ) );
+ $this->assertNull( $list->getClaimWithGuid(
$statement2->getGuid() ) );
}
public function testIterator() {
$expected = array(
- 'TESTCLAIM1' => $this->makeClaim( new
PropertyNoValueSnak( new PropertyId( 'P42' ) ), 'testclaim1' ),
- 'TESTCLAIM2' => $this->makeClaim( new
PropertySomeValueSnak( new PropertyId( 'P42' ) ), 'testclaim2' ),
- 'TESTCLAIM3' => $this->makeClaim( new
PropertyNoValueSnak( new PropertyId( 'P23' ) ), 'testclaim3' ),
- 'TESTCLAIM4' => $this->makeClaim( new
PropertyNoValueSnak( new PropertyId( 'P9000' ) ), 'testclaim4' ),
+ 'GUID1' => $this->makeStatement( new
PropertyNoValueSnak( new PropertyId( 'P42' ) ), 'guid1' ),
+ 'GUID2' => $this->makeStatement( new
PropertySomeValueSnak( new PropertyId( 'P42' ) ), 'guid2' ),
+ 'GUID3' => $this->makeStatement( new
PropertyNoValueSnak( new PropertyId( 'P23' ) ), 'guid3' ),
+ 'GUID4' => $this->makeStatement( new
PropertyNoValueSnak( new PropertyId( 'P9000' ) ), 'guid4' ),
);
$claims = new Claims( $expected );
diff --git a/vendor/wikibase/data-model/tests/unit/Snak/SnakListTest.php
b/vendor/wikibase/data-model/tests/unit/Snak/SnakListTest.php
index a1b22ab..a47092b 100644
--- a/vendor/wikibase/data-model/tests/unit/Snak/SnakListTest.php
+++ b/vendor/wikibase/data-model/tests/unit/Snak/SnakListTest.php
@@ -183,8 +183,15 @@
* @var array
*/
$rawArguments = array(
- //default order
- array( array(), array() ),
+ 'Default order' => array(
+ array(),
+ array(),
+ ),
+ 'Unknown id in order' => array(
+ array(),
+ array(),
+ array( 'P1' )
+ ),
array(
array( new PropertyNoValueSnak( $id1 ) ),
array( new PropertyNoValueSnak( $id1 ) ),
@@ -211,8 +218,7 @@
new PropertyNoValueSnak( $id2 ),
),
),
- //with additional order
- array(
+ 'With additional order' => array(
array(
new PropertyNoValueSnak( $id3 ),
new PropertyNoValueSnak( $id2 ),
@@ -223,7 +229,7 @@
new PropertyNoValueSnak( $id3 ),
new PropertyValueSnak( $id1, new
StringValue( 'a' ) ),
),
- array( $id2->getSerialization() )
+ array( 'P2' )
),
array(
array(
@@ -234,21 +240,20 @@
new PropertyNoValueSnak( $id1 ),
),
array(
-
new PropertyValueSnak( $id1, new
StringValue( 'a' ) ),
new PropertyNoValueSnak( $id1 ),
new PropertyNoValueSnak( $id3 ),
new PropertyNoValueSnak( $id2 ),
new PropertyNoValueSnak( $id2 ),
),
- array( $id1->getSerialization() )
+ array( 'P1' )
),
);
$arguments = array();
- foreach ( $rawArguments as $rawArgument ) {
- $arguments[] = array(
+ foreach ( $rawArguments as $key => $rawArgument ) {
+ $arguments[$key] = array(
new $class( $rawArgument[0] ),
new $class( $rawArgument[1] ),
array_key_exists( 2, $rawArgument ) ?
$rawArgument[2] : array()
--
To view, visit https://gerrit.wikimedia.org/r/222158
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I15bc8a6c6f4e6cd7648f375dde5b01b8cc632359
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: wmf/1.26wmf12
Gerrit-Owner: Hoo man <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits