PhpOrient\ConnectionTokenTest::testSessionRenew PHP Метод

testSessionRenew() публичный Метод

public testSessionRenew ( )
    public function testSessionRenew()
    {
        $client = new PhpOrient('localhost', 2424);
        $client->setSessionToken(true);
        // set true to enable the token based authentication
        $clusterID = $client->dbOpen("GratefulDeadConcerts", 'admin', 'admin');
        $sessionToken = $client->getSessionToken();
        // store this token somewhere
        unset($client);
        // start a new connection
        $client = new PhpOrient('localhost', 2424);
        // set the previous received token to re-attach to the old session
        $client->setSessionToken($sessionToken);
        //now the dbOpen is not needed to perform database operations
        $records = $client->query('select * from V limit 10');
        $this->assertNotEmpty($records);
        //set the flag again to true if you want to renew the token
        $client->setSessionToken(true);
        // set true
        $clusterID = $client->dbOpen("GratefulDeadConcerts", 'admin', 'admin');
        $new_sessionToken = $client->getSessionToken();
        $this->assertNotEquals($sessionToken, $new_sessionToken);
    }