Skip to content
Merged
Show file tree
Hide file tree
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
42 changes: 42 additions & 0 deletions tests/unit/Snak/PropertyNoValueSnakTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Wikibase\Test\Snak;

use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Snak\PropertyNoValueSnak;

/**
* @covers Wikibase\DataModel\Snak\PropertyNoValueSnak
*
* @group Wikibase
* @group WikibaseDataModel
* @group WikibaseSnak
*
* @licence GNU GPL v2+
* @author Thiemo Mättig
*/
class PropertyNoValueSnakTest extends SnakObjectTest {

public function constructorProvider() {
return array(
array( true, new PropertyId( 'P1' ) ),
array( true, new PropertyId( 'P9001' ) ),
);
}

public function getClass() {
return 'Wikibase\DataModel\Snak\PropertyNoValueSnak';
}

/**
* This test is a safeguard to make sure hashes are not changed unintentionally.
*/
public function testHashStability() {
$snak = new PropertyNoValueSnak( new PropertyId( 'P1' ) );
$hash = $snak->getHash();

$expected = sha1( 'C:43:"Wikibase\DataModel\Snak\PropertyNoValueSnak":4:{i:1;}' );
$this->assertSame( $expected, $hash );
}

}
42 changes: 42 additions & 0 deletions tests/unit/Snak/PropertySomeValueSnakTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Wikibase\Test\Snak;

use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Snak\PropertySomeValueSnak;

/**
* @covers Wikibase\DataModel\Snak\PropertySomeValueSnak
*
* @group Wikibase
* @group WikibaseDataModel
* @group WikibaseSnak
*
* @licence GNU GPL v2+
* @author Thiemo Mättig
*/
class PropertySomeValueSnakTest extends SnakObjectTest {

public function constructorProvider() {
return array(
array( true, new PropertyId( 'P1' ) ),
array( true, new PropertyId( 'P9001' ) ),
);
}

public function getClass() {
return 'Wikibase\DataModel\Snak\PropertySomeValueSnak';
}

/**
* This test is a safeguard to make sure hashes are not changed unintentionally.
*/
public function testHashStability() {
$snak = new PropertySomeValueSnak( new PropertyId( 'P1' ) );
$hash = $snak->getHash();

$expected = sha1( 'C:45:"Wikibase\DataModel\Snak\PropertySomeValueSnak":4:{i:1;}' );
$this->assertSame( $expected, $hash );
}

}
1 change: 0 additions & 1 deletion tests/unit/Snak/PropertyValueSnakTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function getClass() {

/**
* This test is a safeguard to make sure hashes are not changed unintentionally.
* @see EntityIdTest::testSerializationStability
*/
public function testHashStability() {
$snak = new PropertyValueSnak( new PropertyId( 'P1' ), new StringValue( 'a' ) );
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/Snak/SnakObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract function getClass();
*
* @since 0.1
*
* @return array
* @return array[]
*/
public abstract function constructorProvider();

Expand Down Expand Up @@ -114,7 +114,6 @@ public function testGetHash( Snak $snak ) {

/**
* This test is a safeguard to make sure hashes are not changed unintentionally.
* @see EntityIdTest::testSerializationStability
*/
public abstract function testHashStability();

Expand Down