test/snac/data/ConstellationTest.php
/**
      * Test that equals() can ignore NameEntry contributors
      */
Test that equals() can ignore NameEntry contributors
Test that equals () can ignore NameEntry contributors
public function testEqualsCanIgnoreContributors() {
         $id1 = new \snac\data\Constellation();
         $id2 = new \snac\data\Constellation();
         $jsonIn = file_get_contents("test/snac/data/json/constellation_test.json");
         $id1->fromJSON($jsonIn);
         $id2->fromJSON($jsonIn);
         $name1 = new \snac\data\NameEntry();
         $name2 = new \snac\data\NameEntry();
         $nameData1 = array("dataType" => "NameEntry",
                            "contributors" => [[ "dataType" => "Contributor", "name" => "Original"]]);
         $nameData2 = array("dataType" => "NameEntry",
                            "contributors" => [[ "dataType" => "Contributor", "name" => "Different"]]);
        $name1->fromArray($nameData1);
        $name2->fromArray($nameData2);
        $id1->addNameEntry($name1);
        $id2->addNameEntry($name2);
        $this->assertFalse($id1->equals($id2, true, true));
        $this->assertFalse($id1->equals($id2, false, true));
        $this->assertTrue($id1->equals($id2, true, false));
        $this->assertTrue($id1->equals($id2, false, false), "Equals failed to ignore contributors");
     }
public function testEqualsCanIgnoreContributors ( ) { $ id1 = new \ snac \ data \ Constellation ( ) ; $ id2 = new \ snac \ data \ Constellation ( ) ; $ jsonIn = file_get_contents ( " test/snac/data/json/constellation_test.json " ) ; $ id1 -> fromJSON ( $ jsonIn ) ; $ id2 -> fromJSON ( $ jsonIn ) ; $ name1 = new \ snac \ data \ NameEntry ( ) ; $ name2 = new \ snac \ data \ NameEntry ( ) ; $ nameData1 = array ( " dataType " => " NameEntry " , " contributors " => [ [ " dataType " => " Contributor " , " name " => " Original " ] ] ) ; $ nameData2 = array ( " dataType " => " NameEntry " , " contributors " => [ [ " dataType " => " Contributor " , " name " => " Different " ] ] ) ; $ name1 -> fromArray ( $ nameData1 ) ; $ name2 -> fromArray ( $ nameData2 ) ; $ id1 -> addNameEntry ( $ name1 ) ; $ id2 -> addNameEntry ( $ name2 ) ; $ this -> assertFalse ( $ id1 -> equals ( $ id2 , true , true ) ) ; $ this -> assertFalse ( $ id1 -> equals ( $ id2 , false , true ) ) ; $ this -> assertTrue ( $ id1 -> equals ( $ id2 , true , false ) ) ; $ this -> assertTrue ( $ id1 -> equals ( $ id2 , false , false ) , " Equals failed to ignore contributors " ) ; }
Test that equals() can ignore NameEntry contributors
Test that equals () can ignore NameEntry contributors
//should be inequal with $strict and $checkSubcomponents //should be inequal with $checkSubcomponents //should be equal without $strict and $checkSubcomponents