-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVariableTest.php
50 lines (44 loc) · 1.16 KB
/
VariableTest.php
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Flight: An extensible micro-framework.
*
* @copyright Copyright (c) 2012, Mike Cao <[email protected]>
* @license MIT, http://flightphp.com/license
*/
require_once 'PHPUnit/Autoload.php';
require_once __DIR__.'/../flight/autoload.php';
class VariableTest extends PHPUnit_Framework_TestCase
{
/**
* @var \flight\Engine
*/
private $app;
function setUp() {
$this->app = new \flight\Engine();
}
// Set and get a variable
function testSetAndGet() {
$this->app->set('a', 1);
$var = $this->app->get('a');
$this->assertEquals(1, $var);
}
// Clear a specific variable
function testClear() {
$this->app->set('b', 1);
$this->app->clear('b');
$var = $this->app->get('b');
$this->assertEquals(null, $var);
}
// Clear all variables
function testClearAll() {
$this->app->set('c', 1);
$this->app->clear();
$var = $this->app->get('c');
$this->assertEquals(null, $var);
}
// Check if a variable exists
function testHas() {
$this->app->set('d', 1);
$this->assertTrue($this->app->has('d'));
}
}