| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Wikibase\DataModel\Tests\Entity; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use InvalidArgumentException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Wikibase\DataModel\Entity\Property; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Wikibase\DataModel\Entity\PropertyId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Wikibase\DataModel\Snak\PropertyNoValueSnak; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Wikibase\DataModel\Statement\Statement; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Wikibase\DataModel\Statement\StatementList; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Wikibase\DataModel\Term\Fingerprint; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * @covers Wikibase\DataModel\Entity\Property | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @covers Wikibase\DataModel\Entity\Entity | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @group Wikibase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * @group WikibaseProperty | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * @group WikibaseDataModel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * @group PropertyTest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @licence GNU GPL v2+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * @author Jeroen De Dauw < [email protected] > | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | class PropertyTest extends EntityTest { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 	 * @see EntityTest::getNewEmpty | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	 * @since 0.1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	 * @return Property | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 	protected function getNewEmpty() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 		return Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	public function testConstructorWithAllParameters() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 		$property = new Property( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 			new PropertyId( 'P42' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 			new Fingerprint(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 			'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 			new StatementList() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 		$this->assertInstanceOf( 'Wikibase\DataModel\Entity\Property', $property ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 		$this->assertEquals( new PropertyId( 'P42' ), $property->getId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 		$this->assertEquals( new Fingerprint(), $property->getFingerprint() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		$this->assertEquals( 'string', $property->getDataTypeId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		$this->assertEquals( new StatementList(), $property->getStatements() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	public function testConstructorWithMinimalParameters() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 		$property = new Property( null, null, '' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 		$this->assertInstanceOf( 'Wikibase\DataModel\Entity\Property', $property ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		$this->assertNull( $property->getId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 		$this->assertEquals( new Fingerprint(), $property->getFingerprint() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 		$this->assertEquals( '', $property->getDataTypeId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 		$this->assertEquals( new StatementList(), $property->getStatements() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 	 * @expectedException InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 	public function testGivenInvalidType_ConstructorThrowsException() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 		new Property( null, null, null ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	public function testNewFromType() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 		$this->assertInstanceOf( 'Wikibase\DataModel\Entity\Property', $property ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 		$this->assertEquals( 'string', $property->getDataTypeId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 	public function testSetAndGetDataTypeId() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 		foreach ( array( 'string', 'foobar', 'nyan', 'string' ) as $typeId ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 			$property->setDataTypeId( $typeId ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 			$this->assertEquals( $typeId, $property->getDataTypeId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	public function testWhenIdSetWithNumber_GetIdReturnsPropertyId() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 		$property->setId( 42 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 		$this->assertHasCorrectIdType( $property ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 	protected function assertHasCorrectIdType( Property $property ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 		$this->assertInstanceOf( 'Wikibase\DataModel\Entity\PropertyId', $property->getId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 	public function testWhenIdSetWithPropertyId_GetIdReturnsPropertyId() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 		$property->setId( new PropertyId( 'P42' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 		$this->assertHasCorrectIdType( $property ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 	public function testPropertyWithTypeIsEmpty() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 		$this->assertTrue( Property::newFromType( 'string' )->isEmpty() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 	public function testPropertyWithIdIsEmpty() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 		$property->setId( 1337 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 		$this->assertTrue( $property->isEmpty() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 	public function testPropertyWithFingerprintIsNotEmpty() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 		$property->getFingerprint()->setAliasGroup( 'en', array( 'foo' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 		$this->assertFalse( $property->isEmpty() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 	public function testClearRemovesAllButId() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 		$property->setId( 42 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 		$property->getFingerprint()->setLabel( 'en', 'foo' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 		$property->getStatements()->addNewStatement( new PropertyNoValueSnak( 1 ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 		$property->clear(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 		$this->assertEquals( new PropertyId( 'P42' ), $property->getId() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 		$this->assertTrue( $property->isEmpty() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 	public function testGetStatementsReturnsEmptyListForEmptyProperty() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 		$this->assertEquals( new StatementList(), $property->getStatements() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 	public function testSetAndGetStatements() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 		$statementList = $this->newNonEmptyStatementList(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 		$property->setStatements( $statementList ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 		$this->assertEquals( $statementList, $property->getStatements() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 	private function newNonEmptyStatementList() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 		$statementList = new StatementList(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 		$statementList->addNewStatement( new PropertyNoValueSnak( 42 ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 		$statementList->addNewStatement( new PropertyNoValueSnak( 1337 ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 		return $statementList; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 	public function equalsProvider() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 		$firstProperty = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 		$firstProperty->setStatements( $this->newNonEmptyStatementList() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 		$secondProperty = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 		$secondProperty->setStatements( $this->newNonEmptyStatementList() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 		$secondPropertyWithId = clone $secondProperty; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 		$secondPropertyWithId->setId( 42 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 		$differentId = clone $secondPropertyWithId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 		$differentId->setId( 43 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 		return array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 			array( Property::newFromType( 'string' ), Property::newFromType( 'string' ) ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 			array( $firstProperty, $secondProperty ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 			array( $secondProperty, $secondPropertyWithId ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 			array( $secondPropertyWithId, $differentId ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 	 * @dataProvider equalsProvider | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 	public function testEquals( Property $firstProperty, Property $secondProperty ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 		$this->assertTrue( $firstProperty->equals( $secondProperty ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 		$this->assertTrue( $secondProperty->equals( $firstProperty ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 	private function getBaseProperty() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 		$property->setId( 42 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 		$property->getFingerprint()->setLabel( 'en', 'Same' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 		$property->getFingerprint()->setDescription( 'en', 'Same' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 		$property->getFingerprint()->setAliasGroup( 'en', array( 'Same' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 		$property->setStatements( $this->newNonEmptyStatementList() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 		return $property; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 	public function notEqualsProvider() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 		$differentLabel = $this->getBaseProperty(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 		$differentLabel->getFingerprint()->setLabel( 'en', 'Different' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 		$differentDescription = $this->getBaseProperty(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 		$differentDescription->getFingerprint()->setDescription( 'en', 'Different' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 		$differentAlias = $this->getBaseProperty(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 		$differentAlias->getFingerprint()->setAliasGroup( 'en', array( 'Different' ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 		$differentStatement = $this->getBaseProperty(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 		$differentStatement->setStatements( new StatementList() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 		$property = $this->getBaseProperty(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 		return array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 			'empty' => array( $property, Property::newFromType( 'string' ) ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 			'label' => array( $property, $differentLabel ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 			'description' => array( $property, $differentDescription ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 			'alias' => array( $property, $differentAlias ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 			'dataType' => array( Property::newFromType( 'string' ), Property::newFromType( 'foo' ) ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 			'statement' => array( $property, $differentStatement ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 	 * @dataProvider notEqualsProvider | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 	public function testNotEquals( Property $firstProperty, Property $secondProperty ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | 		$this->assertFalse( $firstProperty->equals( $secondProperty ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 		$this->assertFalse( $secondProperty->equals( $firstProperty ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 	public function testPropertyWithStatementsIsNotEmpty() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 		$property = Property::newFromType( 'string' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 		$property->setStatements( $this->newNonEmptyStatementList() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 		$this->assertFalse( $property->isEmpty() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 232 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 233 |  |  | 	public function testClone() { | 
            
                                                                        
                            
            
                                    
            
            
                | 234 |  |  | 		$id = new PropertyId( 'P1' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 235 |  |  | 		$fingerprint = new Fingerprint(); | 
            
                                                                        
                            
            
                                    
            
            
                | 236 |  |  | 		$fingerprint->setLabel( 'en', 'original' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 237 |  |  | 		$statement = new Statement( new PropertyNoValueSnak( 1 ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 238 |  |  | 		$statements = new StatementList( $statement ); | 
            
                                                                        
                            
            
                                    
            
            
                | 239 |  |  | 		$original = new Property( $id, $fingerprint, 'string', $statements ); | 
            
                                                                        
                            
            
                                    
            
            
                | 240 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 241 |  |  | 		$clone = clone $original; | 
            
                                                                        
                            
            
                                    
            
            
                | 242 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 243 |  |  | 		// The clone must not reference the same mutable objects | 
            
                                                                        
                            
            
                                    
            
            
                | 244 |  |  | 		$this->assertSame( 'property', $clone->getType() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 245 |  |  | 		$this->assertSame( 'string', $clone->getDataTypeId() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 246 |  |  | 		$this->assertSame( $id, $clone->getId(), 'id is immutable and must not be cloned' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 247 |  |  | 		$this->assertNotSame( $fingerprint, $clone->getFingerprint() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 248 |  |  | 		$this->assertNotSame( $statements, $clone->getStatements() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 249 |  |  | 		$this->assertNotSame( $statement, $clone->getStatements()->toArray()[0] ); | 
            
                                                                        
                            
            
                                    
            
            
                | 250 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 251 |  |  | 		// Modify the clone | 
            
                                                                        
                            
            
                                    
            
            
                | 252 |  |  | 		$clone->getFingerprint()->setLabel( 'en', 'clone' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 253 |  |  | 		$clonedStatement = $clone->getStatements()->toArray()[0]; | 
            
                                                                        
                            
            
                                    
            
            
                | 254 |  |  | 		$clonedStatement->setRank( Statement::RANK_DEPRECATED ); | 
            
                                                                        
                            
            
                                    
            
            
                | 255 |  |  | 		$clonedStatement->getQualifiers()->addSnak( new PropertyNoValueSnak( 1 ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 256 |  |  | 		$clonedStatement->getReferences()->addNewReference( new PropertyNoValueSnak( 1 ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 258 |  |  | 		// The original must not change | 
            
                                                                        
                            
            
                                    
            
            
                | 259 |  |  | 		$this->assertSame( 'original', $original->getFingerprint()->getLabel( 'en' )->getText() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 260 |  |  | 		$originalStatement = $original->getStatements()->toArray()[0]; | 
            
                                                                        
                            
            
                                    
            
            
                | 261 |  |  | 		$this->assertSame( Statement::RANK_NORMAL, $originalStatement->getRank() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 262 |  |  | 		$this->assertTrue( $originalStatement->getQualifiers()->isEmpty() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 263 |  |  | 		$this->assertTrue( $originalStatement->getReferences()->isEmpty() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 264 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 266 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 267 |  |  |  | 
            
                        
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.