| Conditions | 3 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 48 | function testNoAccessFile() |
||
| 49 | { |
||
| 50 | // existed file without write access for current user. |
||
| 51 | // for Ubuntu is /etc/hosts. |
||
| 52 | $file_name = "/etc/hosts"; |
||
| 53 | |||
| 54 | if (!file_exists($file_name)) { |
||
| 55 | self::markTestSkipped("test only for *nix."); |
||
| 56 | } |
||
| 57 | |||
| 58 | if (is_writable($file_name)) { |
||
| 59 | self::markTestSkipped("test runned under super/admin user. Change user."); |
||
| 60 | } |
||
| 61 | |||
| 62 | self::expectException("DanchukAS\DenyMultiplyRun\Exception\OpenFileFail"); |
||
| 63 | DenyMultiplyRun::setPidFile($file_name); |
||
| 64 | } |
||
| 68 |
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.
If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with
private, and only raise it toprotectedif a sub-class needs to have access, orpublicif an external class needs access.