Marking certain tests as skipped, if not on a 64-bit system

This commit is contained in:
Ben Ramsey
2013-01-04 21:33:15 -06:00
parent f877161a5c
commit f8292a6823
2 changed files with 30 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Rhumsaa\Uuid;
class TestCase extends \PHPUnit_Framework_TestCase
{
/**
* If the system is 32-bit, this will mark a test as skipped
*/
protected function skip64BitTest()
{
if (PHP_INT_SIZE == 4) {
$this->markTestSkipped(
'Skipping test that can run only on a 64-bit build of PHP.'
);
}
}
}
+13 -1
View File
@@ -1,7 +1,9 @@
<?php
namespace Rhumsaa\Uuid;
class UuidTest extends \PHPUnit_Framework_TestCase
require 'TestCase.php';
class UuidTest extends TestCase
{
protected function setUp()
{
@@ -154,6 +156,8 @@ class UuidTest extends \PHPUnit_Framework_TestCase
*/
public function testGetFields()
{
$this->skip64BitTest();
$fields = array(
'time_low' => 4285500592,
'time_mid' => 50557,
@@ -228,6 +232,8 @@ class UuidTest extends \PHPUnit_Framework_TestCase
*/
public function testGetNode()
{
$this->skip64BitTest();
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
$this->assertEquals(8796630719078, $uuid->getNode());
}
@@ -264,6 +270,8 @@ class UuidTest extends \PHPUnit_Framework_TestCase
*/
public function testGetTimeLow()
{
$this->skip64BitTest();
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
$this->assertEquals(4285500592, $uuid->getTimeLow());
}
@@ -300,6 +308,8 @@ class UuidTest extends \PHPUnit_Framework_TestCase
*/
public function testGetTimestamp()
{
$this->skip64BitTest();
// Check for a recent date
$uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
$this->assertEquals(135606608744910000, $uuid->getTimestamp());
@@ -530,6 +540,8 @@ class UuidTest extends \PHPUnit_Framework_TestCase
*/
public function testUuid1WithNodeAndClockSequence()
{
$this->skip64BitTest();
$uuid = Uuid::uuid1(0x0800200c9a66, 0x1669);
$this->assertInstanceOf('\Rhumsaa\Uuid\Uuid', $uuid);
$this->assertInstanceOf('\DateTime', $uuid->getDateTime());