diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
index e3bb845ab9..216df2b579 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
@@ -227,7 +227,12 @@ class FormPassTest extends TestCase
$container->setDefinition('form.extension', $extDefinition);
$container->register($id, 'stdClass')->setPublic(false)->addTag($tagName);
- $this->setExpectedException('\InvalidArgumentException', $expectedExceptionMessage);
+ if (method_exists($this, 'expectException')) {
+ $this->expectException('InvalidArgumentException');
+ $this->expectExceptionMessage($expectedExceptionMessage);
+ } else {
+ $this->setExpectedException('InvalidArgumentException', $expectedExceptionMessage);
+ }
$container->compile();
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
index 3426daf434..0b5565e0b3 100644
--- a/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php
@@ -55,7 +55,12 @@ class ArrayNodeTest extends TestCase
public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $message = '')
{
if ($expected instanceof \Exception) {
- $this->setExpectedException(get_class($expected), $expected->getMessage());
+ if (method_exists($this, 'expectException')) {
+ $this->expectException(get_class($expected));
+ $this->expectExceptionMessage($expected->getMessage());
+ } else {
+ $this->setExpectedException(get_class($expected), $expected->getMessage());
+ }
}
$node = new ArrayNode('root');
$node->setIgnoreExtraKeys($ignore, $remove);
diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
index e7dc2ce9ea..dcd42a42f6 100644
--- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -2424,6 +2424,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
// compare plain HTML to check the whitespace
try {
$this->assertSame('', $html);
+ } catch (\PHPUnit\Framework\AssertionFailedError $e) {
+ $this->assertSame('', $html);
} catch (\PHPUnit_Framework_AssertionFailedError $e) {
$this->assertSame('', $html);
}
diff --git a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
index 74382135e2..6588c32fdf 100644
--- a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
@@ -20,7 +20,11 @@ class TranslationFilesTest extends TestCase
*/
public function testTranslationFileIsValid($filePath)
{
- \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
+ if (class_exists('PHPUnit_Util_XML')) {
+ \PHPUnit_Util_XML::loadfile($filePath, false, false, true);
+ } else {
+ \PHPUnit\Util\XML::loadfile($filePath, false, false, true);
+ }
}
public function provideTranslationFiles()