Phalcon\Test\Unit\SecurityTest::testOneTokenPerRequest PHP Method

testOneTokenPerRequest() public method

Tests Security::getToken and Security::getTokenKey for generating only one token per request
    public function testOneTokenPerRequest()
    {
        $this->specify("The Security::getToken and Security::getTokenKey must return only one token per request", function () {
            $di = $this->setupDI();
            $s = new Security();
            $s->setDI($di);
            $tokenKey = $s->getTokenKey();
            $token = $s->getToken();
            expect($tokenKey)->equals($s->getTokenKey());
            expect($token)->equals($s->getToken());
            expect($token)->equals($s->getSessionToken());
            $s->destroyToken();
            expect($tokenKey)->notEquals($s->getTokenKey());
            expect($token)->notEquals($s->getToken());
            expect($token)->notEquals($s->getSessionToken());
            $s->destroyToken();
        });
    }