| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function testRegister() |
||
| 17 | { |
||
| 18 | $signalHandler = SignalHandler::getInstance(); |
||
| 19 | $username = ''; |
||
| 20 | $signalHandler->register(SIGUSR1, function() use(&$username){ |
||
| 21 | $username = 'foo'; |
||
| 22 | }); |
||
| 23 | posix_kill(getmypid(), SIGUSR1); |
||
| 24 | usleep(100); |
||
| 25 | $this->assertEquals('foo', $username); |
||
| 26 | } |
||
| 27 | |||
| 51 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: