Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions tests/unit/Statement/StatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,6 @@ public function validConstructorArgumentsProvider() {
);
}

/**
* @dataProvider invalidConstructorArgumentsProvider
* @expectedException InvalidArgumentException
*/
public function testConstructorWithInvalidArguments(
$mainSnak,
$qualifiers,
$references,
$guid
) {
new Statement( $mainSnak, $qualifiers, $references, $guid );
}

public function invalidConstructorArgumentsProvider() {
$snak = new PropertyNoValueSnak( 1 );

return array(
array( $snak, null, null, false ),
array( $snak, null, null, 1 ),
);
}

/**
* @dataProvider instanceProvider
*/
Expand Down Expand Up @@ -141,11 +119,32 @@ public function testGuidDoesNotAffectHash() {
$this->assertEquals( $statement0->getHash(), $statement1->getHash() );
}

public function testSetInvalidGuidCausesException() {
/**
* @dataProvider invalidGuidProvider
* @expectedException InvalidArgumentException
*/
public function testGivenInvalidGuid_constructorThrowsException( $guid ) {
new Statement( new PropertyNoValueSnak( 1 ), null, null, $guid );
}

/**
* @dataProvider invalidGuidProvider
* @expectedException InvalidArgumentException
*/
public function testGivenInvalidGuid_setGuidThrowsException( $guid ) {
$statement = new Statement( new PropertyNoValueSnak( 42 ) );
$statement->setGuid( $guid );
}

$this->setExpectedException( 'InvalidArgumentException' );
$statement->setGuid( 42 );
public function invalidGuidProvider() {
$snak = new PropertyNoValueSnak( 1 );

return array(
array( false ),
array( 1 ),
array( $snak ),
array( new Statement( $snak ) ),
);
}

public function instanceProvider() {
Expand Down