Skip to content

Commit a1bd210

Browse files
committed
Clean-up dataProvider docs and type hints
1 parent cc06fa4 commit a1bd210

9 files changed

Lines changed: 28 additions & 58 deletions

tests/unit/ByPropertyIdArrayTest.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ function( Snak $snak ) {
117117

118118
/**
119119
* @dataProvider listProvider
120-
* @param Snak[] $objects
121120
*/
122121
public function testGetIds( array $objects ) {
123122
$indexedArray = new ByPropertyIdArray( $objects );
@@ -140,7 +139,6 @@ public function testGetIds( array $objects ) {
140139

141140
/**
142141
* @dataProvider listProvider
143-
* @param array $objects
144142
*/
145143
public function testGetById( array $objects ) {
146144
$indexedArray = new ByPropertyIdArray( $objects );
@@ -172,7 +170,6 @@ public function testGetById( array $objects ) {
172170

173171
/**
174172
* @dataProvider listProvider
175-
* @param array $objects
176173
*/
177174
public function testRemoveObject( array $objects ) {
178175
$lastIndex = count( $objects ) - 1;
@@ -222,7 +219,6 @@ public function testNotBuildExceptionIsThrownForGetPropertyIds() {
222219

223220
/**
224221
* @dataProvider listProvider
225-
* @param array $objects
226222
*/
227223
public function testGetFlatArrayIndexOfObject( array $objects ) {
228224
$indexedArray = new ByPropertyIdArray( $objects );
@@ -242,7 +238,6 @@ public function testGetFlatArrayIndexOfObject( array $objects ) {
242238

243239
/**
244240
* @dataProvider listProvider
245-
* @param array $objects
246241
*/
247242
public function testToFlatArray( array $objects ) {
248243
$indexedArray = new ByPropertyIdArray( $objects );
@@ -308,10 +303,10 @@ public function moveProvider() {
308303

309304
/**
310305
* @dataProvider moveProvider
311-
* @param array $objectsSource
306+
* @param object[] $objectsSource
312307
* @param object $object
313308
* @param int $toIndex
314-
* @param array $objectsDestination
309+
* @param object[] $objectsDestination
315310
*/
316311
public function testMoveObjectToIndex(
317312
array $objectsSource,
@@ -387,10 +382,10 @@ public function addProvider() {
387382

388383
/**
389384
* @dataProvider addProvider
390-
* @param array $objectsSource
385+
* @param object[] $objectsSource
391386
* @param object $object
392-
* @param int $index
393-
* @param array $objectsDestination
387+
* @param int|null $index
388+
* @param object[] $objectsDestination
394389
*/
395390
public function testAddObjectAtIndex(
396391
array $objectsSource,

tests/unit/ByPropertyIdGrouperTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public function provideGetPropertyIds() {
5050

5151
/**
5252
* @dataProvider provideGetPropertyIds
53-
*
5453
* @param PropertyIdProvider[] $propertyIdProviders
5554
* @param PropertyId[] $expectedPropertyIds
5655
*/
@@ -82,7 +81,6 @@ public function provideGetByPropertyId() {
8281

8382
/**
8483
* @dataProvider provideGetByPropertyId
85-
*
8684
* @param PropertyIdProvider[] $propertyIdProviders
8785
* @param string $propertyId
8886
* @param string[] $expectedValues
@@ -120,10 +118,9 @@ public function provideHasPropertyId() {
120118

121119
/**
122120
* @dataProvider provideHasPropertyId
123-
*
124121
* @param PropertyIdProvider[] $propertyIdProviders
125122
* @param string $propertyId
126-
* @param boolean $expectedValue
123+
* @param bool $expectedValue
127124
*/
128125
public function testHasPropertyId( array $propertyIdProviders, $propertyId, $expectedValue ) {
129126
$byPropertyIdGrouper = new ByPropertyIdGrouper( $propertyIdProviders );

tests/unit/Claim/ClaimGuidTest.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Exception;
66
use Wikibase\DataModel\Claim\ClaimGuid;
7+
use Wikibase\DataModel\Entity\EntityId;
78
use Wikibase\DataModel\Entity\ItemId;
89

910
/**
@@ -20,12 +21,11 @@ class ClaimGuidTest extends \PHPUnit_Framework_TestCase {
2021

2122
/**
2223
* @dataProvider provideConstructionData
23-
*
24-
* @param $entityId
25-
* @param $guid
26-
* @param $expected
24+
* @param EntityId $entityId
25+
* @param string $guid
26+
* @param string $expected
2727
*/
28-
public function testConstructor( $entityId, $guid, $expected ) {
28+
public function testConstructor( EntityId $entityId, $guid, $expected ) {
2929
$claimGuid = new ClaimGuid( $entityId, $guid );
3030

3131
$this->assertEquals( $expected, $claimGuid->getSerialization() );
@@ -56,9 +56,6 @@ public function provideConstructionData() {
5656

5757
/**
5858
* @dataProvider provideBadConstruction
59-
*
60-
* @param $entityId
61-
* @param $guid
6259
*/
6360
public function testBadConstruction( $entityId, $guid ) {
6461
$this->setExpectedException( 'InvalidArgumentException' );
@@ -90,21 +87,19 @@ public function provideClaimGuids() {
9087

9188
/**
9289
* @dataProvider provideClaimGuids
93-
*
9490
* @param ClaimGuid $claimGuid
9591
*/
96-
public function testEquals( $claimGuid ) {
92+
public function testEquals( ClaimGuid $claimGuid ) {
9793
$claimGuidCopy = clone $claimGuid;
9894
$this->assertTrue( $claimGuid->equals( $claimGuidCopy ) );
9995
$this->assertTrue( $claimGuidCopy->equals( $claimGuid ) );
10096
}
10197

10298
/**
10399
* @dataProvider provideClaimGuids
104-
*
105100
* @param ClaimGuid $claimGuid
106101
*/
107-
public function testNotEquals( $claimGuid ) {
102+
public function testNotEquals( ClaimGuid $claimGuid ) {
108103
$notEqualClaimGuid = new ClaimGuid( new ItemId( 'q9999' ), 'someguid' );
109104
$this->assertFalse( $claimGuid->equals( $notEqualClaimGuid ) );
110105
$this->assertFalse( $notEqualClaimGuid->equals( $claimGuid ) );

tests/unit/Entity/Diff/EntityDiffTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ public function isEmptyProvider() {
5151

5252
/**
5353
* @dataProvider isEmptyProvider
54-
*
55-
* @param array $diffOps
56-
* @param boolean $isEmpty
54+
* @param Diff[] $diffOps
55+
* @param bool $isEmpty
5756
*/
5857
public function testIsEmpty( array $diffOps, $isEmpty ) {
5958
$diff = new EntityDiff( $diffOps );

tests/unit/Entity/Diff/ItemDiffTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,8 @@ public function isEmptyProvider() {
251251

252252
/**
253253
* @dataProvider isEmptyProvider
254-
*
255-
* @param array $diffOps
256-
* @param boolean $isEmpty
254+
* @param Diff[] $diffOps
255+
* @param bool $isEmpty
257256
*/
258257
public function testIsEmpty( array $diffOps, $isEmpty ) {
259258
$diff = new ItemDiff( $diffOps );

tests/unit/Entity/EntityTest.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ public function descriptionProvider() {
9999
/**
100100
* @dataProvider descriptionProvider
101101
* @param string $languageCode
102-
* @param string $labelText
102+
* @param string $description
103103
* @param string $moarText
104104
*/
105-
public function testSetDescription( $languageCode, $labelText, $moarText = 'ohi there' ) {
105+
public function testSetDescription( $languageCode, $description, $moarText = 'ohi there' ) {
106106
$entity = $this->getNewEmpty();
107107

108-
$entity->setDescription( $languageCode, $labelText );
108+
$entity->setDescription( $languageCode, $description );
109109

110-
$this->assertEquals( $labelText, $entity->getDescription( $languageCode ) );
110+
$this->assertEquals( $description, $entity->getDescription( $languageCode ) );
111111

112112
$entity->setDescription( $languageCode, $moarText );
113113

@@ -117,26 +117,26 @@ public function testSetDescription( $languageCode, $labelText, $moarText = 'ohi
117117
/**
118118
* @dataProvider descriptionProvider
119119
* @param string $languageCode
120-
* @param string $labelText
120+
* @param string $description
121121
*/
122-
public function testGetDescription( $languageCode, $labelText ) {
122+
public function testGetDescription( $languageCode, $description ) {
123123
$entity = $this->getNewEmpty();
124124

125125
$this->assertFalse( $entity->getDescription( $languageCode ) );
126126

127-
$entity->setDescription( $languageCode, $labelText );
127+
$entity->setDescription( $languageCode, $description );
128128

129-
$this->assertEquals( $labelText, $entity->getDescription( $languageCode ) );
129+
$this->assertEquals( $description, $entity->getDescription( $languageCode ) );
130130
}
131131

132132
/**
133133
* @dataProvider descriptionProvider
134134
* @param string $languageCode
135-
* @param string $labelText
135+
* @param string $description
136136
*/
137-
public function testRemoveDescription( $languageCode, $labelText ) {
137+
public function testRemoveDescription( $languageCode, $description ) {
138138
$entity = $this->getNewEmpty();
139-
$entity->setDescription( $languageCode, $labelText );
139+
$entity->setDescription( $languageCode, $description );
140140
$entity->removeDescription( $languageCode );
141141
$this->assertFalse( $entity->getDescription( $languageCode ) );
142142
}
@@ -364,7 +364,6 @@ public function instanceProvider() {
364364

365365
/**
366366
* @dataProvider instanceProvider
367-
*
368367
* @param Entity $entity
369368
*/
370369
public function testCopy( Entity $entity ) {
@@ -391,7 +390,6 @@ public function testCopyRetainsLabels() {
391390

392391
/**
393392
* @dataProvider instanceProvider
394-
*
395393
* @param Entity $entity
396394
*/
397395
public function testSerialize( Entity $entity ) {
@@ -407,7 +405,6 @@ public function testSerialize( Entity $entity ) {
407405

408406
/**
409407
* @dataProvider instanceProvider
410-
*
411408
* @param Entity $entity
412409
*/
413410
public function testHasClaims( Entity $entity ) {
@@ -482,7 +479,6 @@ public function diffProvider() {
482479

483480
/**
484481
* @dataProvider diffProvider
485-
*
486482
* @param Entity $entity0
487483
* @param Entity $entity1
488484
* @param EntityDiff $expected
@@ -499,7 +495,6 @@ public function testDiffEntities( Entity $entity0, Entity $entity1, EntityDiff $
499495

500496
/**
501497
* @dataProvider instanceProvider
502-
*
503498
* @param Entity $entity
504499
*/
505500
public function testGetClaims( Entity $entity ) {
@@ -510,7 +505,6 @@ public function testGetClaims( Entity $entity ) {
510505

511506
/**
512507
* @dataProvider instanceProvider
513-
*
514508
* @param Entity $entity
515509
*/
516510
public function testGetAllSnaks( Entity $entity ) {

tests/unit/ReferenceListTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public function invalidConstructorArgumentsProvider() {
7979

8080
/**
8181
* @dataProvider instanceProvider
82-
*
8382
* @param ReferenceList $array
8483
*/
8584
public function testHasReferenceBeforeRemoveButNotAfter( ReferenceList $array ) {
@@ -115,7 +114,6 @@ public function testGivenCloneOfReferenceInList_hasReferenceReturnsTrue() {
115114

116115
/**
117116
* @dataProvider instanceProvider
118-
*
119117
* @param ReferenceList $array
120118
*/
121119
public function testRemoveReference( ReferenceList $array ) {
@@ -213,7 +211,6 @@ public function testGivenEmptyReferenceAndIndex_addReferenceDoesNotAdd() {
213211

214212
/**
215213
* @dataProvider instanceProvider
216-
*
217214
* @param ReferenceList $array
218215
*/
219216
public function testIndexOf( ReferenceList $array ) {
@@ -227,7 +224,6 @@ public function testIndexOf( ReferenceList $array ) {
227224

228225
/**
229226
* @dataProvider instanceProvider
230-
*
231227
* @param ReferenceList $array
232228
*/
233229
public function testEquals( ReferenceList $array ) {
@@ -237,7 +233,6 @@ public function testEquals( ReferenceList $array ) {
237233

238234
/**
239235
* @dataProvider instanceProvider
240-
*
241236
* @param ReferenceList $array
242237
*/
243238
public function testGetHashReturnsString( ReferenceList $array ) {
@@ -246,7 +241,6 @@ public function testGetHashReturnsString( ReferenceList $array ) {
246241

247242
/**
248243
* @dataProvider instanceProvider
249-
*
250244
* @param ReferenceList $array
251245
*/
252246
public function testGetHashValueIsTheSameForClone( ReferenceList $array ) {

tests/unit/ReferenceTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public function instanceProvider() {
8181

8282
/**
8383
* @dataProvider snakListProvider
84-
*
8584
* @param Snaks $snaks
8685
*/
8786
public function testConstructor( Snaks $snaks ) {
@@ -257,7 +256,6 @@ public function testCanConstructWithSnakArray() {
257256

258257
/**
259258
* @dataProvider invalidConstructorArgumentsProvider
260-
* @param mixed $snaks
261259
* @expectedException InvalidArgumentException
262260
*/
263261
public function testGivenInvalidConstructorArguments_constructorThrowsException( $snaks ) {

tests/unit/Snak/SnakListTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public function constructorProvider() {
7474

7575
/**
7676
* @dataProvider invalidConstructorArgumentsProvider
77-
* @param mixed $input
7877
* @expectedException InvalidArgumentException
7978
*/
8079
public function testGivenInvalidConstructorArguments_constructorThrowsException( $input ) {

0 commit comments

Comments
 (0)