From 3eb923cc84db6898bf1c2b343d2684360dbefbd1 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Thu, 1 Mar 2012 23:30:07 -0500 Subject: [PATCH] Skip Doctrine tests if libraries are not available --- Tests/Doctrine/MongoDB/ListenerTest.php | 7 +++++++ Tests/Doctrine/ORM/ListenerTest.php | 7 +++++++ Tests/Doctrine/RepositoryManagerTest.php | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/Tests/Doctrine/MongoDB/ListenerTest.php b/Tests/Doctrine/MongoDB/ListenerTest.php index 0b664dd..c2f94a5 100644 --- a/Tests/Doctrine/MongoDB/ListenerTest.php +++ b/Tests/Doctrine/MongoDB/ListenerTest.php @@ -11,6 +11,13 @@ class Document{} */ class ListenerTest extends \PHPUnit_Framework_TestCase { + public function setUp() + { + if (!class_exists('Doctrine\ODM\MongoDB\DocumentManager')) { + $this->markTestSkipped('Doctrine MongoDB ODM is not available.'); + } + } + public function testObjectInsertedOnPersist() { $persisterMock = $this->getMockBuilder('FOQ\ElasticaBundle\Persister\ObjectPersisterInterface') diff --git a/Tests/Doctrine/ORM/ListenerTest.php b/Tests/Doctrine/ORM/ListenerTest.php index 9a632c3..6afdec8 100644 --- a/Tests/Doctrine/ORM/ListenerTest.php +++ b/Tests/Doctrine/ORM/ListenerTest.php @@ -11,6 +11,13 @@ class Entity{} */ class ListenerTest extends \PHPUnit_Framework_TestCase { + public function setUp() + { + if (!class_exists('Doctrine\ORM\EntityManager')) { + $this->markTestSkipped('Doctrine ORM is not available.'); + } + } + public function testObjectInsertedOnPersist() { $persisterMock = $this->getMockBuilder('FOQ\ElasticaBundle\Persister\ObjectPersisterInterface') diff --git a/Tests/Doctrine/RepositoryManagerTest.php b/Tests/Doctrine/RepositoryManagerTest.php index 3ef80f4..d518b0c 100644 --- a/Tests/Doctrine/RepositoryManagerTest.php +++ b/Tests/Doctrine/RepositoryManagerTest.php @@ -13,6 +13,12 @@ class Entity{} */ class RepositoryManagerTest extends \PHPUnit_Framework_TestCase { + public function setUp() + { + if (!interface_exists('Doctrine\Common\Persistence\ManagerRegistry')) { + $this->markTestSkipped('Doctrine Common is not available.'); + } + } public function testThatGetRepositoryReturnsDefaultRepository() {