From 2ddfc6af5a81123b45c5e19fd4e1699366c0fc11 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 9 Nov 2011 08:17:46 +0100 Subject: [PATCH] Fixed failing tests in PHPUnit 3.6.2 (expecting \Exception was deprecated) --- .../OneToManyUnidirectionalAssociationTest.php | 13 ++++++++++--- .../Tests/ORM/Functional/Ticket/DDC117Test.php | 11 +++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManyUnidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManyUnidirectionalAssociationTest.php index fd7a22a5a..42fd29235 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManyUnidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManyUnidirectionalAssociationTest.php @@ -73,7 +73,14 @@ class OneToManyUnidirectionalAssociationTest extends \Doctrine\Tests\OrmFunction $this->_em->persist($routeA); $this->_em->persist($routeB); - $this->setExpectedException('Exception'); // depends on the underyling Database Driver - $this->_em->flush(); // Exception + $exceptionThrown = false; + try { + // exception depending on the underyling Database Driver + $this->_em->flush(); + } catch(\Exception $e) { + $exceptionThrown = true; + } + + $this->assertTrue($exceptionThrown, "The underlying database driver throws an exception."); } -} \ No newline at end of file +} diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php index 7057b765d..9e1b5b074 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php @@ -209,8 +209,15 @@ class DDC117Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->article1->addTranslation('en', 'Bar'); $this->article1->addTranslation('en', 'Baz'); - $this->setExpectedException('Exception'); - $this->_em->flush(); + $exceptionThrown = false; + try { + // exception depending on the underyling Database Driver + $this->_em->flush(); + } catch(\Exception $e) { + $exceptionThrown = true; + } + + $this->assertTrue($exceptionThrown, "The underlying database driver throws an exception."); } /**