Jobby\Tests\HelperTest::testLockFileShouldContainCurrentPid PHP Method

testLockFileShouldContainCurrentPid() public method

    public function testLockFileShouldContainCurrentPid()
    {
        $this->helper->acquireLock($this->lockFile);
        //on Windows, file locking is mandatory not advisory, so you can't do file_get_contents on a locked file
        //therefore, we need to make a copy of the lock file in order to read its contents
        if ($this->helper->getPlatform() === Helper::WINDOWS) {
            copy($this->lockFile, $this->copyOfLockFile);
            $lockFile = $this->copyOfLockFile;
        } else {
            $lockFile = $this->lockFile;
        }
        $this->assertEquals(getmypid(), file_get_contents($lockFile));
        $this->helper->releaseLock($this->lockFile);
        $this->assertEmpty(file_get_contents($this->lockFile));
    }