-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig.test.php
More file actions
82 lines (58 loc) · 2.32 KB
/
Copy pathconfig.test.php
File metadata and controls
82 lines (58 loc) · 2.32 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
class ConfigTest extends PHPUnit_Framework_TestCase {
public $feather;
public function setUp()
{
$this->feather = Feather\Components\Support\Facade::application();
$this->feather['config']->set('test', $this->items());
}
public function testItemsCanBeSet()
{
$this->feather['config']->set('name', 'jason');
$this->assertEquals('jason', $this->feather['config']->get('name'));
$this->feather['config']->set('person.name', 'jason');
$this->assertEquals('jason', $this->feather['config']->get('person.name'));
$this->feather['config']->set('namespace::person.name', 'jason');
$this->assertEquals('jason', $this->feather['config']->get('namespace::person.name'));
$this->feather['config']->set('gear: mock person.name', 'jason');
$this->assertEquals('jason', $this->feather['config']->get('gear: mock person.name'));
$this->feather['config']->set('theme: mock person.name', 'jason');
$this->assertEquals('jason', $this->feather['config']->get('theme: mock person.name'));
}
public function testGetBasicItems()
{
$this->assertEquals('bar', $this->feather['config']->get('test.foo'));
$this->assertEquals('orange', $this->feather['config']->get('test.apple'));
}
public function testEntireArrayCanBeReturned()
{
$this->assertEquals($this->items(), $this->feather['config']->get('test'));
}
public function testCheckItemExistance()
{
$this->feather['config']->set('foo', 'bar');
$this->assertTrue($this->feather['config']->has('foo'));
$this->assertTrue(!$this->feather['config']->has('apple'));
}
public function testItemsCanBeSaved()
{
$this->feather['config']->set('feather: db.test', 'foobar');
$this->feather['config']->save('feather: db.test');
$this->feather['config']->reload();
$this->assertEquals('foobar', $this->feather['config']->get('feather: db.test'));
$this->feather['config']->delete('feather: db.test');
}
public function testItemsCanBeDeleted()
{
$this->feather['config']->set('feather: db.test', 'foobar');
$this->feather['config']->save('feather: db.test');
$this->feather['config']->reload();
$this->feather['config']->delete('feather: db.test');
$this->feather['config']->reload();
$this->assertEquals(null, $this->feather['config']->get('feather: db.test'));
}
public function items()
{
return array('foo' => 'bar', 'apple' => 'orange');
}
}