Skip to content

Commit

Permalink
Tests: disable some tests for HHVM
Browse files Browse the repository at this point in the history
  • Loading branch information
vasa-c committed Apr 1, 2016
1 parent ebdc1f0 commit 70c2720
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
20 changes: 15 additions & 5 deletions tests/FSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
class FSTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -276,8 +277,12 @@ public function testCopy()
$this->assertSame('test content', file_get_contents($fnDest));
unlink($fnSrc);
unlink($fnDest);
$this->setExpectedException('axy\fs\ifs\errors\FSError');
$this->fs->copy($fnSrc, $fnDest);
if (Helpers::isHHVM()) {
$this->markTestSkipped('HHVM');
} else {
$this->setExpectedException('axy\fs\ifs\errors\FSError');
$this->fs->copy($fnSrc, $fnDest);
}
}

/**
Expand Down Expand Up @@ -673,9 +678,14 @@ public function testCreateTmpFile()
$file->setPosition(1);
$this->assertSame('ont', $file->read(3));
$meta = $file->getMetaData();
$this->assertFileExists($meta->filename);
$file->close();
$this->assertFileNotExists($meta->filename);
if (Helpers::isHHVM()) {
$file->close();
$this->markTestSkipped('HHVM');
} else {
$this->assertFileExists($meta->filename);
$file->close();
$this->assertFileNotExists($meta->filename);
}
}

/**
Expand Down
12 changes: 12 additions & 0 deletions tests/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ public static function clearDir($dir)
}
}
}

/**
* @return bool
*/
public static function isHHVM()
{
static $isH;
if ($isH === null) {
$isH = (strpos(strtolower(PHP_VERSION), 'hiphop') !== false);
}
return $isH;
}
}
8 changes: 6 additions & 2 deletions tests/RealFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,12 @@ public function testGetMetaData()
$this->assertSame($fn, $meta->filename);
$this->assertSame("rt", $meta->mode);
$this->assertSame(false, $meta->eof);
$this->setExpectedException('axy\fs\real\errors\FSError');
$file->getMetaData();
if (Helpers::isHHVM()) {
$this->markTestSkipped('HHVM');
} else {
$this->setExpectedException('axy\fs\real\errors\FSError');
$file->getMetaData();
}
}

public function testLockNot()
Expand Down

0 comments on commit 70c2720

Please sign in to comment.