| Total Complexity | 7 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class ExistWrongPidFileTest extends TestCase |
||
| 15 | { |
||
| 16 | |||
| 17 | private static $existFileName; |
||
| 18 | |||
| 19 | function setUp() |
||
|
|
|||
| 20 | { |
||
| 21 | self::$existFileName = tempnam(sys_get_temp_dir(), 'vo_'); |
||
| 22 | } |
||
| 23 | |||
| 24 | function tearDown() |
||
| 25 | { |
||
| 26 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
||
| 27 | @unlink(self::$existFileName); |
||
|
1 ignored issue
–
show
|
|||
| 28 | } |
||
| 29 | |||
| 30 | |||
| 31 | function testNoValidPid() |
||
| 32 | { |
||
| 33 | file_put_contents(self::$existFileName, "12as"); |
||
| 34 | |||
| 35 | self::expectException("DanchukAS\DenyMultiplyRun\Exception\ConvertPidFail"); |
||
| 36 | DenyMultiplyRun::setPidFile(self::$existFileName); |
||
| 37 | } |
||
| 38 | |||
| 39 | |||
| 40 | function testBiggerPid() |
||
| 46 | } |
||
| 47 | |||
| 48 | function testNoAccessFile() |
||
| 49 | { |
||
| 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.