Files
yii2/tests/framework/web/SessionTest.php

31 lines
619 B
PHP

<?php
namespace yiiunit\framework\web;
use yii\web\Session;
use yiiunit\TestCase;
/**
* @group web
*/
class SessionTest extends TestCase
{
/**
* Test to prove that Session::destroy generates session with new identifier
*/
public function testDestroySessionId()
{
$session = new Session();
$session->open();
$oldSessionId = @session_id();
$this->assertNotEmpty($oldSessionId);
$session->destroy();
$newSessionId = @session_id();
$this->assertNotEmpty($newSessionId);
$this->assertEquals($oldSessionId, $newSessionId);
}
}