Skip to content

Commit

Permalink
Better checking if internal classes can be mocked
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Jul 31, 2014
1 parent eb8d3c8 commit 92f6576
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/Aws/Tests/S3/Sync/AbstractSyncTest.php
Expand Up @@ -25,8 +25,8 @@ class AbstractSyncTest extends \Guzzle\Tests\GuzzleTestCase
{
public function setUp()
{
if (in_array(PHP_VERSION_ID, array(50429, 50513, 50600))) {
$this->markTestSkipped('TODO: Remove once PHPUnit is tagged.');
if (!\can_mock_internal_classes()) {
$this->markTestSkipped('Cannot mock internal classes');
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Aws/Tests/S3/Sync/ChangedFilesIteratorTest.php
Expand Up @@ -26,8 +26,8 @@ class ChangedFilesIteratorTest extends \Guzzle\Tests\GuzzleTestCase
{
public function setUp()
{
if (in_array(PHP_VERSION_ID, array(50429, 50513, 50600))) {
$this->markTestSkipped('TODO: Remove once PHPUnit is tagged.');
if (!\can_mock_internal_classes()) {
$this->markTestSkipped('Cannot mock internal classes');
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Aws/Tests/S3/Sync/DownloadSyncTest.php
Expand Up @@ -27,8 +27,8 @@ class DownloadSyncTest extends \Guzzle\Tests\GuzzleTestCase
{
public function setUp()
{
if (in_array(PHP_VERSION_ID, array(50429, 50513, 50600))) {
$this->markTestSkipped('TODO: Remove once PHPUnit is tagged.');
if (!\can_mock_internal_classes()) {
$this->markTestSkipped('Cannot mock internal classes');
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Aws/Tests/S3/Sync/UploadSyncTest.php
Expand Up @@ -30,8 +30,8 @@ class UploadSyncTest extends \Guzzle\Tests\GuzzleTestCase

public function setUp()
{
if (in_array(PHP_VERSION_ID, array(50429, 50513, 50600))) {
$this->markTestSkipped('TODO: Remove once PHPUnit is tagged.');
if (!\can_mock_internal_classes()) {
$this->markTestSkipped('Cannot mock internal classes');
}

$this->tmpFile = null;
Expand Down
14 changes: 14 additions & 0 deletions tests/bootstrap.php
Expand Up @@ -68,3 +68,17 @@

// Emit deprecation warnings
Guzzle\Common\Version::$emitWarnings = true;

function can_mock_internal_classes()
{
switch (substr(PHP_VERSION, 0, 3)) {
case '5.3.':
return true;
case '5.4.':
return version_compare(PHP_VERSION, '5.4.30', '<');
case '5.5.':
return version_compare(PHP_VERSION, '5.5.14', '<');
default:
return false;
}
}

0 comments on commit 92f6576

Please sign in to comment.