1 | <?php |
||
13 | class AccessMagicTest extends PHPUnit_Framework_TestCase { |
||
14 | |||
15 | /** |
||
16 | * @var AccessMagic $object |
||
17 | */ |
||
18 | protected $object; |
||
19 | |||
20 | public function setUp() { |
||
21 | parent::setUp(); |
||
22 | |||
23 | $this->object = new AccessMagic(); |
||
24 | } |
||
25 | |||
26 | public function tearDown() { |
||
27 | unset($this->object); |
||
28 | parent::tearDown(); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @covers ::__get |
||
33 | * @covers ::__isset |
||
34 | * @covers ::__set |
||
35 | * @covers ::__unset |
||
36 | * @covers ::isEmpty |
||
37 | * @covers ::asArray |
||
38 | * @covers ::clear |
||
39 | */ |
||
40 | public function test__get() { |
||
41 | $this->assertTrue($this->object->isEmpty()); |
||
42 | $this->assertFalse(isset($this->object->test)); |
||
43 | $this->assertNull($this->object->test); |
||
44 | |||
45 | $this->object->test = 'value'; |
||
46 | $this->assertFalse($this->object->isEmpty()); |
||
47 | $this->assertAttributeEquals(array('test' => 'value'), 'values', $this->object); |
||
48 | $this->assertTrue(isset($this->object->test)); |
||
49 | $this->assertEquals('value', $this->object->test); |
||
50 | |||
51 | $this->assertAttributeEquals($this->object->asArray(), 'values', $this->object); |
||
52 | |||
53 | unset($this->object->test); |
||
54 | $this->assertTrue($this->object->isEmpty()); |
||
55 | $this->assertFalse(isset($this->object->test)); |
||
56 | $this->assertNull($this->object->test); |
||
57 | $this->assertAttributeEquals(array(), 'values', $this->object); |
||
58 | |||
59 | $this->object->test = 'value'; |
||
60 | $this->object->clear(); |
||
61 | $this->assertTrue($this->object->isEmpty()); |
||
62 | } |
||
63 | |||
64 | } |
||
65 |