PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 4.0.4
Responsive Menu – Create Mobile-Friendly Menu v4.0.4
4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 All 90 releases
responsive-menu / tests / app / Container / ContainerTest.php

ContainerTest.php in Responsive Menu – Create Mobile-Friendly Menu 4.0.4, at tests/app/Container/ContainerTest.php

67 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use PHPUnit\Framework\TestCase;
4 use ResponsiveMenu\Container\Container;
5
6 class ContainerTest extends TestCase {
7
8 public function testCreatedObjectIsReturn() {
9 $container = new Container;
10 $container['std'] = function($c) {
11 return new \StdClass;
12 };
13 $this->assertInstanceOf('StdClass', $container['std']);
14 }
15
16 public function testCreatedObjectIsReturnedWithDependencies() {
17 $container = new Container;
18 $container['std'] = function($c) {
19 return new \StdClass;
20 };
21 $container['std_two'] = function($c) {
22 return new \StdClass($c['std']);
23 };
24 $this->assertInstanceOf('StdClass', $container['std']);
25 $this->assertInstanceOf('StdClass', $container['std_two']);
26 }
27
28 public function testVariableIsReturned() {
29 $container = new Container;
30 $container['var'] = 5;
31 $this->assertEquals(5, $container['var']);
32 }
33
34 public function testVariableIsset() {
35 $container = new Container;
36 $container['var'] = 5;
37 $this->assertTrue(isset($container['var']));
38 $this->assertFalse(isset($container['not_set']));
39 }
40
41 public function testVariableKeys() {
42 $container = new Container;
43 $container['var'] = 5;
44 $container['var_two'] = 6;
45 $this->assertEquals(['var', 'var_two'], $container->keys());
46 }
47
48 /**
49 * @expectedException \InvalidArgumentException
50 */
51 public function testExceptionThrownIfDoesntExist() {
52 $container = new Container;
53 $container['doesnt_exist'];
54 }
55
56 /**
57 * @expectedException \InvalidArgumentException
58 */
59 public function testExceptionThrownIfDoesntExistAfterUnsetting() {
60 $container = new Container;
61 $container['to_delete'] = 5;
62 unset($container['to_delete']);
63 $container['to_delete'];
64 }
65
66 }
67