blob: 6a831183cd5ec410fcbfbf4001f934bec3f27cd5 (
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());
}
}
|