mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: Fix tests on PHPUnit 3.4
This commit is contained in:
parent
2c42ffdba7
commit
6db08cbc36
@ -681,6 +681,22 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
self::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide assertEmpty() in PHPUnit <3.5.
|
||||
* We want to support PHPUnit 3.4, as this is the most recent release available
|
||||
* to environments running PHP <=5.2.6, such as Debian Lenny.
|
||||
*/
|
||||
public static function assertEmpty($item, $message = '') {
|
||||
if(class_exists('PHPUnit_Framework_Constraint_IsEmpty')) {
|
||||
parent::assertEmpty($item, $message);
|
||||
} else {
|
||||
if(!empty($item)) {
|
||||
$message = $message ? $message : "Failed asserting that " . var_export($item, true) . " is empty.";
|
||||
throw new PHPUnit_Framework_AssertionFailedError($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for the DOS matchers
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@ class DeprecationTest extends SapphireTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Error_Notice
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
*/
|
||||
function testEqualVersionTriggersNotice() {
|
||||
Deprecation::notification_version('2.0.0');
|
||||
@ -43,7 +43,7 @@ class DeprecationTest extends SapphireTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Error_Notice
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
*/
|
||||
function testGreaterVersionTriggersNotice() {
|
||||
Deprecation::notification_version('3.0.0');
|
||||
@ -57,7 +57,7 @@ class DeprecationTest extends SapphireTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit_Framework_Error_Notice
|
||||
* @expectedException PHPUnit_Framework_Error
|
||||
*/
|
||||
function testMatchingModuleNotifcationVersionAffectsNotice() {
|
||||
Deprecation::notification_version('1.0.0');
|
||||
|
Loading…
Reference in New Issue
Block a user