Skip to content

Commit 5ef7c57

Browse files
committed
Merge pull request #602 from wmde/snakListTests
Add more edge case tests for SnakList construction
2 parents bc841af + fb56703 commit 5ef7c57

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/unit/Snak/SnakListTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,17 @@ public function invalidConstructorArgumentsProvider() {
9191
array( $id1 ),
9292
array( new PropertyNoValueSnak( $id1 ) ),
9393
array( new PropertyValueSnak( $id1, new StringValue( 'a' ) ) ),
94+
array( array( null ) ),
95+
array( array( $id1 ) ),
96+
array( array( new SnakList() ) ),
9497
);
9598
}
9699

100+
public function testGivenAssociativeArray_constructorPreservesArrayKeys() {
101+
$snakList = new SnakList( array( 'key' => new PropertyNoValueSnak( 1 ) ) );
102+
$this->assertSame( array( 'key' ), array_keys( iterator_to_array( $snakList ) ) );
103+
}
104+
97105
/**
98106
* @dataProvider instanceProvider
99107
* @param SnakList $array

0 commit comments

Comments
 (0)