test/snac/server/database/DBUtilTest.php
/**
     * Test date ranges work with parsed CPF
     */
Test date ranges work with parsed CPF
Test date ranges work with parsed CPF
public function testFullCPFDateIsRange()
    {
        $this->logger->addDebug("Starting: " . __METHOD__);
        $eParser = new \snac\util\EACCPFParser();
        $eParser->setConstellationOperation(\snac\data\AbstractData::$OPERATION_INSERT);
        $cObj = $eParser->parseFile("test/snac/server/database/test_record.xml");
        foreach($cObj->getDateList() as $gObj)
        {
            $gObj->setRange(false);
            $this->assertFalse($gObj->getIsRange());
        }
        $json = $cObj->toJSON();
        $secondObj = new \snac\data\Constellation();
        $secondObj->fromJSON($json);
        $retObj = $this->dbu->writeConstellation($this->user, 
                                                 $secondObj,       
                                                 'testing ingest full CPF record with ingest cpf', 
                                                 'ingest cpf'); 
        $this->assertTrue($secondObj->equals($retObj, false), "Initial parsed constellation doesn't equal written one");
        $readObj = $this->dbu->readConstellation($retObj->getID());
        foreach($readObj->getDateList() as $gObj)
        {
            $this->assertFalse($gObj->getIsRange());
        }
        $this->logger->addDebug("Ending: " . __METHOD__);
    }
public function testFullCPFDateIsRange ( ) { $ this -> logger -> addDebug ( " Starting:  " . __METHOD__ ) ; $ eParser = new \ snac \ util \ EACCPFParser ( ) ; $ eParser -> setConstellationOperation ( \ snac \ data \ AbstractData :: $ OPERATION_INSERT ) ; $ cObj = $ eParser -> parseFile ( " test/snac/server/database/test_record.xml " ) ; foreach ( $ cObj -> getDateList ( ) as $ gObj ) { $ gObj -> setRange ( false ) ; $ this -> assertFalse ( $ gObj -> getIsRange ( ) ) ; } $ json = $ cObj -> toJSON ( ) ; $ secondObj = new \ snac \ data \ Constellation ( ) ; $ secondObj -> fromJSON ( $ json ) ; $ retObj = $ this -> dbu -> writeConstellation ( $ this -> user , $ secondObj , 'testing ingest full CPF record with ingest cpf' , 'ingest cpf' ) ; $ this -> assertTrue ( $ secondObj -> equals ( $ retObj , false ) , " Initial parsed constellation doesn't equal written one " ) ; $ readObj = $ this -> dbu -> readConstellation ( $ retObj -> getID ( ) ) ; foreach ( $ readObj -> getDateList ( ) as $ gObj ) { $ this -> assertFalse ( $ gObj -> getIsRange ( ) ) ; } $ this -> logger -> addDebug ( " Ending:  " . __METHOD__ ) ; }
Test date ranges work with parsed CPF
Test date ranges work with parsed CPF
/*
         * Explicitly set isRange to false on all exist dates. The bug is/was that on reading it becomes true.
         */ /*
             * setRange() w/o "Is" and getIsRange() w/ "Is" are the setter and getter.
             */ /*
         * Put the new object through json and back to make sure that retains the false isRange settings.
         */ // $user // $argObj // $note // $statusArg /*
             * setRange() w/o "Is" and getIsRange() w/ "Is" are the setter and getter.
             */