| @@ 37-50 (lines=14) @@ | ||
| 34 | ->isEqualTo("Youpi!"); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function testOn() |
|
| 38 | { |
|
| 39 | $this |
|
| 40 | ->given($handler = function () { |
|
| 41 | echo "Youpi!"; |
|
| 42 | }) |
|
| 43 | ->then |
|
| 44 | ->array($this->adapter->get('name')) |
|
| 45 | ->hasSize(0) |
|
| 46 | ->when($this->adapter->on('name', $handler)) |
|
| 47 | ->then |
|
| 48 | ->array($this->adapter->get('name')) |
|
| 49 | ->hasSize(1); |
|
| 50 | } |
|
| 51 | ||
| 52 | public function testOnce() |
|
| 53 | { |
|
| @@ 75-91 (lines=17) @@ | ||
| 72 | } |
|
| 73 | ||
| 74 | ||
| 75 | public function testRemove() |
|
| 76 | { |
|
| 77 | $this |
|
| 78 | ->given( |
|
| 79 | $handler = function () { |
|
| 80 | echo "Youpi!"; |
|
| 81 | }, |
|
| 82 | $this->adapter->on('name', $handler) |
|
| 83 | ) |
|
| 84 | ->then |
|
| 85 | ->array($this->adapter->get('name')) |
|
| 86 | ->hasSize(1) |
|
| 87 | ->when($this->adapter->remove('name', $handler)) |
|
| 88 | ->then |
|
| 89 | ->array($this->adapter->get('name')) |
|
| 90 | ->hasSize(0); |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||