blob: 31072e6a64bee4c25127e947b9aa0202290c6a4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
require_once __DIR__.'/../Base.php';
use Core\Session;
use Model\UserSession;
class UserSessionTest extends Base
{
public function testIsAdmin()
{
$s = new Session;
$us = new UserSession($this->container);
$this->assertFalse($us->isAdmin());
$s['user'] = array();
$this->assertFalse($us->isAdmin());
$s['user'] = array('is_admin' => '1');
$this->assertFalse($us->isAdmin());
$s['user'] = array('is_admin' => false);
$this->assertFalse($us->isAdmin());
$s['user'] = array('is_admin' => '2');
$this->assertFalse($us->isAdmin());
$s['user'] = array('is_admin' => true);
$this->assertTrue($us->isAdmin());
}
}
|