test/snac/server/database/DBUtilTest.php
/**
     * Exercise listConstellationsWithStatusForUser() and listConstellationsWithStatusForAny()
     *
     * We test with 'locked editing' which is user sensitive and 'published' which is for all users.
     */
Exercise listConstellationsWithStatusForUser() and listConstellationsWithStatusForAny()
We test with 'locked editing' which is user sensitive and 'published' which is for all users.
Exercise listConstellationsWithStatusForUser () and listConstellationsWithStatusForAny () We test with ' locked editing ' which is user sensitive and ' published ' which is for all users .
public function testWithStatus()
    {
        $this->logger->addDebug("Starting: " . __METHOD__);
        $objList = $this->dbu->listConstellationsWithStatusForUser($this->user, 'locked editing');
        foreach ($objList as $c) {
            $this->dbu->writeConstellationStatus($this->user, $c->getID(), "published");
        }
        $eParser = new \snac\util\EACCPFParser();
        $eParser->setConstellationOperation(\snac\data\AbstractData::$OPERATION_INSERT);
        $cObj = $eParser->parseFile("test/snac/server/database/test_record.xml");
        for ($i = 1; $i <= 6; $i++)
            $this->dbu->writeConstellation($this->user,
                                           $cObj,
                                           "TestWithStatus Database Test".$i,
                                           'ingest cpf');
        $objList = $this->dbu->listConstellationsWithStatusForUser($this->user, 'locked editing');
        $this->assertEquals(6, count($objList), "Should have 6 in locked editing for this user");
        if (count($objList) > 5)
        {
            $objList = $this->dbu->listConstellationsWithStatusForUser($this->user, 'locked editing', 5);
            $this->assertTrue(count($objList)==5);
            $objList = $this->dbu->listConstellationsWithStatusForUser($this->user, 'locked editing', 5, 1);
            $this->assertTrue(count($objList)==5);
        }
        $objList = $this->dbu->listConstellationsWithStatusForAny('published');
        $this->assertTrue(count($objList)>=1);
        $objList = $this->dbu->listConstellationsWithStatusForAny('published', 10);
        $this->assertTrue(count($objList)==10);
        $objList = $this->dbu->listConstellationsWithStatusForAny('published', 10, 10);
        $this->assertTrue(count($objList)==10);
        $this->logger->addDebug("Ending: " . __METHOD__);
    }
public function testWithStatus ( ) { $ this -> logger -> addDebug ( " Starting:  " . __METHOD__ ) ; $ objList = $ this -> dbu -> listConstellationsWithStatusForUser ( $ this -> user , 'locked editing' ) ; foreach ( $ objList as $ c ) { $ this -> dbu -> writeConstellationStatus ( $ this -> user , $ c -> getID ( ) , " published " ) ; } $ eParser = new \ snac \ util \ EACCPFParser ( ) ; $ eParser -> setConstellationOperation ( \ snac \ data \ AbstractData :: $ OPERATION_INSERT ) ; $ cObj = $ eParser -> parseFile ( " test/snac/server/database/test_record.xml " ) ; for ( $ i = 1 ; $ i <= 6 ; $ i ++ ) $ this -> dbu -> writeConstellation ( $ this -> user , $ cObj , " TestWithStatus Database Test " . $ i , 'ingest cpf' ) ; $ objList = $ this -> dbu -> listConstellationsWithStatusForUser ( $ this -> user , 'locked editing' ) ; $ this -> assertEquals ( 6 , count ( $ objList ) , " Should have 6 in locked editing for this user " ) ; if ( count ( $ objList ) > 5 ) { $ objList = $ this -> dbu -> listConstellationsWithStatusForUser ( $ this -> user , 'locked editing' , 5 ) ; $ this -> assertTrue ( count ( $ objList ) == 5 ) ; $ objList = $ this -> dbu -> listConstellationsWithStatusForUser ( $ this -> user , 'locked editing' , 5 , 1 ) ; $ this -> assertTrue ( count ( $ objList ) == 5 ) ; } $ objList = $ this -> dbu -> listConstellationsWithStatusForAny ( 'published' ) ; $ this -> assertTrue ( count ( $ objList ) >= 1 ) ; $ objList = $ this -> dbu -> listConstellationsWithStatusForAny ( 'published' , 10 ) ; $ this -> assertTrue ( count ( $ objList ) == 10 ) ; $ objList = $ this -> dbu -> listConstellationsWithStatusForAny ( 'published' , 10 , 10 ) ; $ this -> assertTrue ( count ( $ objList ) == 10 ) ; $ this -> logger -> addDebug ( " Ending:  " . __METHOD__ ) ; }
Exercise listConstellationsWithStatusForUser() and listConstellationsWithStatusForAny()
 We test with 'locked editing' which is user sensitive and 'published' which is for all users.
Exercise listConstellationsWithStatusForUser () and listConstellationsWithStatusForAny () We test with ' locked editing ' which is user sensitive and ' published ' which is for all users .
// Make any previous ones published // Write 6 copies of the constellation /*
         * Assume that in 100 records of a test load, at least 20 are status published.
         */