Hoa central
Public Member Functions | List of all members
Hoa\Registry\Test\Unit\Registry Class Reference
Inheritance diagram for Hoa\Registry\Test\Unit\Registry:

Public Member Functions

 case_no_instance ()
 
 case_classic ()
 
 case_value_is_an_object ()
 
 case_isRegistered ()
 
 case_protocol ()
 
 case_value_protocol_and_references ()
 
- Public Member Functions inherited from Hoa\Test\Unit\Suite
 __construct ()
 
 getTestedClassName ()
 
 getTestedClassNamespace ()
 
 beforeTestMethod ($methodName)
 

Detailed Description

Class .

Test suite of the registry.

Definition at line 50 of file Registry.php.

Member Function Documentation

Hoa\Registry\Test\Unit\Registry::case_classic ( )

Definition at line 61 of file Registry.php.

62  {
63  $this
64  ->given(
65  $string = $this->realdom->string('a', 'z', 5),
66  $key = $this->sample($string),
67  $value = $this->sample($string),
68  LUT::set($key, $value)
69  )
70  ->when($result = LUT::get($key))
71  ->then
72  ->string($result)
73  ->isEqualTo($value);
74  }
Hoa\Registry\Test\Unit\Registry::case_isRegistered ( )

Definition at line 93 of file Registry.php.

94  {
95  $this
96  ->given(
97  $string = $this->realdom->string('a', 'z', 5),
98  $key = $this->sample($string),
99  $value = $this->sample($string)
100  )
101  ->when($result = LUT::isRegistered($key))
102  ->then
103  ->boolean($result)
104  ->isFalse()
105 
106  ->when(
107  LUT::set($key, $value),
108  $result = LUT::isRegistered($key)
109  )
110  ->then
111  ->boolean($result)
112  ->isTrue()
113 
114  ->when(
115  LUT::remove($key),
116  $result = LUT::isRegistered($key)
117  )
118  ->then
119  ->boolean($result)
120  ->isFalse();
121  }
Hoa\Registry\Test\Unit\Registry::case_no_instance ( )

Definition at line 52 of file Registry.php.

53  {
54  $this
55  ->exception(function () {
56  new LUT();
57  })
58  ->isInstanceOf('Hoa\Registry\Exception');
59  }
Hoa\Registry\Test\Unit\Registry::case_protocol ( )

Definition at line 123 of file Registry.php.

124  {
125  $this
126  ->given(
127  $string = $this->realdom->string('a', 'z', 5),
128  $key = $this->sample($string),
129  $value = $this->sample($string),
130  LUT::set($key, $value)
131  )
132  ->when($result = resolve('hoa://Library/Registry#' . $key))
133  ->then
134  ->string($result)
135  ->isEqualTo($value);
136  }
Hoa\Registry\Test\Unit\Registry::case_value_is_an_object ( )

Definition at line 76 of file Registry.php.

77  {
78  $this
79  ->given(
80  $string = $this->realdom->string('a', 'z', 5),
81  $object = $this->realdom->class('StdClass'),
82  $key = $this->sample($string),
83  $value = $this->sample($object),
84  LUT::set($key, $value)
85  )
86  ->when($result = LUT::get($key))
87  ->then
88  ->object($result)
89  ->isInstanceOf('StdClass')
90  ->isIdenticalTo($value);
91  }
Hoa\Registry\Test\Unit\Registry::case_value_protocol_and_references ( )

Definition at line 138 of file Registry.php.

139  {
140  $this
141  ->given(
142  $string = $this->realdom->string('a', 'z', 5),
143  $object = $this->realdom->class('StdClass'),
144  $key = $this->sample($string),
145  $value = $this->sample($object),
146  LUT::set($key, $value)
147  )
148  ->when(
149  $result1 = resolve('hoa://Library/Registry#' . $key),
150  $result2 = LUT::get($key)
151  )
152  ->then
153  ->object($result1)
154  ->isInstanceOf('StdClass')
155  ->isIdenticalTo($value)
156  ->isIdenticalTo($result2)
157 
158  ->given($dummy = $this->sample($string))
159  ->when(
160  $result1->foo = $dummy,
161  $result3 = resolve('hoa://Library/Registry#' . $key)
162  )
163  ->then
164  ->object($result1)
165  ->isIdenticalTo($result2)
166  ->isIdenticalTo($result3)
167 
168  ->string($result1->foo)
169  ->isEqualTo($dummy);
170  }

The documentation for this class was generated from the following file: