Jeroen De Dauw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/81536
Change subject: Improve EntityIdTest
......................................................................
Improve EntityIdTest
Change-Id: I4ef087d6f3f4bb65d1276c0803275cc0dcda6d08
---
M tests/phpunit/Entity/EntityIdTest.php
1 file changed, 27 insertions(+), 16 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseDataModel
refs/changes/36/81536/1
diff --git a/tests/phpunit/Entity/EntityIdTest.php
b/tests/phpunit/Entity/EntityIdTest.php
index 8b60a85..53db49b 100644
--- a/tests/phpunit/Entity/EntityIdTest.php
+++ b/tests/phpunit/Entity/EntityIdTest.php
@@ -2,13 +2,13 @@
namespace Wikibase\Test;
+use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\EntityId;
use Wikibase\Item;
use Wikibase\Property;
/**
- * Tests for the Wikibase\EntityId class.
+ * @covers Wikibase\DataModel\Entity\EntityId
*
* @since 0.3
*
@@ -25,26 +25,37 @@
*/
class EntityIdTest extends \PHPUnit_Framework_TestCase {
- public function constructorProvider() {
- $argLists = array();
-
- $argLists[] = array( Item::ENTITY_TYPE, 123 );
- $argLists[] = array( Property::ENTITY_TYPE, 321 );
-
- return $argLists;
- }
-
/**
* @dataProvider constructorProvider
*
* @param string $type
- * @param integer $number
+ * @param integer $serialization
*/
- public function testConstructor( $type, $number ) {
- $id = new EntityId( $type, $number );
+ public function testConstructor( $type, $serialization ) {
+ $id = new EntityId( $type, $serialization );
$this->assertEquals( $type, $id->getEntityType() );
- $this->assertEquals( $number, $id->getNumericId() );
+ $this->assertEquals( strtoupper( $serialization ),
$id->getSerialization() );
+ }
+
+ public function constructorProvider() {
+ $argLists = array();
+
+ $argLists[] = array( Item::ENTITY_TYPE, 'Q123' );
+ $argLists[] = array( Property::ENTITY_TYPE, 'P321' );
+
+ $argLists[] = array( Item::ENTITY_TYPE, 'q123' );
+ $argLists[] = array( Property::ENTITY_TYPE, 'p321' );
+
+ return $argLists;
+ }
+
+ public function testConstructorWithNumericId() {
+ $id = new EntityId( Item::ENTITY_TYPE, 123 );
+ $this->assertEquals( $id->getNumericId(), 123 );
+
+ $id = new EntityId( Property::ENTITY_TYPE, 123 );
+ $this->assertEquals( $id->getNumericId(), 123 );
}
public function instanceProvider() {
@@ -95,7 +106,7 @@
*/
public function testEqualsSimple( EntityId $id ) {
$this->assertTrue( $id->equals( $id ) );
- $this->assertFalse( $id->equals( $id->getNumericId() ) );
+ $this->assertFalse( $id->equals( $id->getSerialization() ) );
$this->assertFalse( $id->equals( $id->getEntityType() ) );
}
--
To view, visit https://gerrit.wikimedia.org/r/81536
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ef087d6f3f4bb65d1276c0803275cc0dcda6d08
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseDataModel
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits