Skip to content

Commit 04dcd4c

Browse files
committed
Skips certain tests in HelperTest which rely on being able to read a locked file
1 parent 68d2168 commit 04dcd4c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/HelperTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ public function testAquireAndReleaseLock()
105105
*/
106106
public function testLockFileShouldContainCurrentPid()
107107
{
108+
if ($this->helper->getPlatform() === Helper::WINDOWS) {
109+
$this->markTestSkipped("It's not possible to read contents of a locked file on Windows");
110+
}
111+
108112
$this->helper->acquireLock($this->lockFile);
109113
$this->assertEquals(getmypid(), file_get_contents($this->lockFile));
110114

@@ -136,6 +140,10 @@ public function testLockLifetimeShouldBeZeroIfFileIsEmpty()
136140
*/
137141
public function testLockLifetimeShouldBeZeroIfItContainsAInvalidPid()
138142
{
143+
if ($this->helper->getPlatform() === Helper::WINDOWS) {
144+
$this->markTestSkipped("Test relies on posix_ functions");
145+
}
146+
139147
file_put_contents($this->lockFile, 'invalid-pid');
140148
$this->assertEquals(0, $this->helper->getLockLifetime($this->lockFile));
141149
}
@@ -145,6 +153,10 @@ public function testLockLifetimeShouldBeZeroIfItContainsAInvalidPid()
145153
*/
146154
public function testGetLocklifetime()
147155
{
156+
if ($this->helper->getPlatform() === Helper::WINDOWS) {
157+
$this->markTestSkipped("Unable to read a locked file on Windows");
158+
}
159+
148160
$this->helper->acquireLock($this->lockFile);
149161

150162
$this->assertEquals(0, $this->helper->getLockLifetime($this->lockFile));

0 commit comments

Comments
 (0)