File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -417,6 +417,31 @@ public function testHasClaims( Entity $entity ) {
417417 $ this ->assertEquals ( count ( $ entity ->getClaims () ) !== 0 , $ has );
418418 }
419419
420+ /**
421+ * Tests Entity::newClaim
422+ *
423+ * @dataProvider instanceProvider
424+ *
425+ * @param Entity $entity
426+ */
427+ public function testNewClaim ( Entity $ entity ) {
428+ if ( $ entity ->getId () === null ) {
429+ $ entity ->setId ( 50 );
430+ }
431+
432+ $ snak = new PropertyNoValueSnak ( 42 );
433+ $ claim = new Statement ( $ snak );
434+ $ claim ->setGuid ( 'q42$foobarbaz ' );
435+
436+ $ this ->assertInstanceOf ( 'Wikibase\DataModel\Claim\Claim ' , $ claim );
437+
438+ $ this ->assertTrue ( $ snak ->equals ( $ claim ->getMainSnak () ) );
439+
440+ $ guid = $ claim ->getGuid ();
441+
442+ $ this ->assertInternalType ( 'string ' , $ guid );
443+ }
444+
420445 public function diffProvider () {
421446 $ argLists = array ();
422447
Original file line number Diff line number Diff line change @@ -84,9 +84,9 @@ public function itemProvider() {
8484 $ items [] = $ item ;
8585
8686 $ item = $ item ->copy ();
87- $ item ->getStatements ()->addNewStatement (
87+ $ item ->getStatements ()->addStatement ( new Statement (
8888 new PropertyNoValueSnak ( new PropertyId ( 'P42 ' ) )
89- );
89+ ) ) ;
9090 $ items [] = $ item ;
9191
9292 $ argLists = array ();
Original file line number Diff line number Diff line change @@ -46,9 +46,9 @@ public function testGetGuid( Statement $statement ) {
4646 }
4747
4848 public function testSetAndGetMainSnak () {
49- $ mainSnak = new PropertyNoValueSnak ( new PropertyId ( 'P42 ' ) );
50- $ statement = new Statement ( $ mainSnak );
51- $ this ->assertSame ( $ mainSnak , $ statement ->getMainSnak () );
49+ $ snak = new PropertyNoValueSnak ( new PropertyId ( 'P42 ' ) );
50+ $ statement = new Statement ( $ snak );
51+ $ this ->assertSame ( $ snak , $ statement ->getMainSnak () );
5252 }
5353
5454 public function testSetAndGetQualifiers () {
You can’t perform that action at this time.
0 commit comments