phpbb_session_testable_factory::check PHP Method

check() public method

Check if the cache used for the generated session contains correct data.
public check ( PHPUnit_Framework_Assert $test )
$test PHPUnit_Framework_Assert The test case to call assert methods on
    public function check(PHPUnit_Framework_Assert $test)
    {
        $this->cache->check($test, $this->get_cache_data());
    }

Usage Example

Beispiel #1
0
	public function test_login_session_create()
	{
		$db = $this->new_dbal();
		$session_factory = new phpbb_session_testable_factory;

		$session = $session_factory->get_session($db);
		$session->page = array('page' => 'page', 'forum' => 0);

		$session->session_create(3);

		$sql = 'SELECT session_user_id
			FROM phpbb_sessions';

		$this->assertSqlResultEquals(
			array(array('session_user_id' => 3)),
			$sql,
			'Check if exacly one session for user id 3 was created'
		);

		$cookie_expire = $session->time_now + 31536000; // default is one year

		$session->check_cookies($this, array(
			'u' => array(null, $cookie_expire),
			'k' => array(null, $cookie_expire),
			'sid' => array($session->session_id, $cookie_expire),
		));

		global $SID, $_SID;
		$this->assertEquals($session->session_id, $_SID);
		$this->assertEquals('?sid=' . $session->session_id, $SID);

		$session_factory->check($this);
	}
All Usage Examples Of phpbb_session_testable_factory::check