Skip to content

Commit 495b412

Browse files
committed
Avoid calling EntityId::newFromNumber when not needed
1 parent e061447 commit 495b412

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

tests/unit/ByPropertyIdArrayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ public function testGetByNotSetIdThrowsException() {
211211

212212
$this->setExpectedException( 'OutOfBoundsException' );
213213

214-
$indexedArray->getByPropertyId( PropertyId::newFromNumber( 9000 ) );
214+
$indexedArray->getByPropertyId( new PropertyId( 'P9000' ) );
215215
}
216216

217217
public function testNotBuildExceptionIsThrownForByPropertyId() {
218218
$indexedArray = new ByPropertyIdArray();
219219

220220
$this->setExpectedException( 'RuntimeException' );
221-
$indexedArray->getByPropertyId( PropertyId::newFromNumber( 9000 ) );
221+
$indexedArray->getByPropertyId( new PropertyId( 'P9000' ) );
222222
}
223223

224224
public function testNotBuildExceptionIsThrownForGetPropertyIds() {

tests/unit/Entity/EntityIdTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use ReflectionClass;
66
use InvalidArgumentException;
7-
use RuntimeException;
87
use Wikibase\DataModel\Entity\EntityId;
98
use Wikibase\DataModel\Entity\ItemId;
109
use Wikibase\DataModel\Entity\PropertyId;

tests/unit/Statement/StatementListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private function getStatement( $propertyId, $guid, $rank = Statement::RANK_NORMA
4242

4343
$statement->expects( $this->any() )
4444
->method( 'getPropertyId' )
45-
->will( $this->returnValue( PropertyId::newFromNumber( $propertyId ) ) );
45+
->will( $this->returnValue( new PropertyId( 'P' . $propertyId ) ) );
4646

4747
$statement->expects( $this->any() )
4848
->method( 'getRank' )

0 commit comments

Comments
 (0)