Skip to content
Browse files

Fix all tests after merging patch for typehinting object manager.

  • Loading branch information...
1 parent 150a4b9 commit a8f3fdfb02c29de2391385a361a3a45364d778c8 @beberlei beberlei committed Jan 25, 2012
View
17 UPGRADE
@@ -0,0 +1,17 @@
+# Between v1.0.0-ALPHA1 and v1.0.0-ALPHA2
+
+The FixtureInterface was changed from
+
+ interface FixtureInterface
+ {
+ load($manager);
+ }
+
+to
+
+ use Doctrine\Common\Persistence\ObjectManager;
+
+ interface FixtureInterface
+ {
+ load(ObjectManager $manager);
+ }
2 lib/vendor/doctrine-common
@@ -1 +1 @@
-Subproject commit 1b112962b09d799237b1b73caf3c838b46d976de
+Subproject commit 0281ab98b27d6f558a8fc3aab61a38507cfbe320
2 lib/vendor/doctrine-dbal
@@ -1 +1 @@
-Subproject commit 173d7ec18e0e7be791308da40df9a64e8516dc90
+Subproject commit 1a0b9de6c017cebc7cb52b30dd05d58dfe9656ba
2 lib/vendor/doctrine-orm
@@ -1 +1 @@
-Subproject commit b05e1ad7ad7fe8bfb7253af790ca87199474658f
+Subproject commit 7595025f2692b1c9f50e2387623f00ddac32f5fc
View
69 tests/Doctrine/Tests/Common/DataFixtures/BaseTest.php
@@ -22,6 +22,7 @@
require_once __DIR__.'/TestInit.php';
use Doctrine\ORM\EntityManager;
+use Doctrine\ORM\Tools\Setup;
use PHPUnit_Framework_TestCase;
/**
@@ -68,38 +69,9 @@ protected function getMockEntityManager()
*/
protected function getMockAnnotationReaderEntityManager()
{
- $driver = $this->getMock('Doctrine\DBAL\Driver');
- $driver->expects($this->once())
- ->method('getDatabasePlatform')
- ->will($this->returnValue($this->getMock('Doctrine\DBAL\Platforms\MySqlPlatform')));
-
- $conn = $this->getMock('Doctrine\DBAL\Connection', array(), array(array(), $driver));
- $conn->expects($this->once())
- ->method('getEventManager')
- ->will($this->returnValue($this->getMock('Doctrine\Common\EventManager')));
-
- $config = $this->getMock('Doctrine\ORM\Configuration');
- $config->expects($this->once())
- ->method('getProxyDir')
- ->will($this->returnValue('test'));
-
- $config->expects($this->once())
- ->method('getProxyNamespace')
- ->will($this->returnValue('Proxies'));
-
- $reader = new \Doctrine\Common\Annotations\AnnotationReader();
- $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
- $mappingDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(
- $reader,
- __DIR__ . '/TestEntity'
- );
-
- $config->expects($this->any())
- ->method('getMetadataDriverImpl')
- ->will($this->returnValue($mappingDriver));
-
- $em = EntityManager::create($conn, $config);
- return $em;
+ $dbParams = array('driver' => 'pdo_sqlite', 'memory' => true);
+ $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__.'/TestEntity'), true);
+ return EntityManager::create($dbParams, $config);
}
/**
@@ -111,33 +83,8 @@ protected function getMockAnnotationReaderEntityManager()
*/
protected function getMockSqliteEntityManager()
{
- $conn = array(
- 'driver' => 'pdo_sqlite',
- 'memory' => true,
- );
-
- $config = $this->getMock('Doctrine\ORM\Configuration');
- $config->expects($this->once())
- ->method('getProxyDir')
- ->will($this->returnValue(sys_get_temp_dir()));
-
- $config->expects($this->once())
- ->method('getProxyNamespace')
- ->will($this->returnValue('Proxy'));
-
- $config->expects($this->once())
- ->method('getAutoGenerateProxyClasses')
- ->will($this->returnValue(true));
-
- $reader = new \Doctrine\Common\Annotations\AnnotationReader();
- $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
- $mappingDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader);
-
- $config->expects($this->any())
- ->method('getMetadataDriverImpl')
- ->will($this->returnValue($mappingDriver));
-
- $em = EntityManager::create($conn, $config);
- return $em;
+ $dbParams = array('driver' => 'pdo_sqlite', 'memory' => true);
+ $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__.'/TestEntity'), true);
+ return EntityManager::create($dbParams, $config);
}
-}
+}
View
37 tests/Doctrine/Tests/Common/DataFixtures/DependentFixtureTest.php
@@ -23,6 +23,7 @@
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\FixtureInterface;
+use Doctrine\Common\Persistence\ObjectManager;
require_once __DIR__.'/TestInit.php';
@@ -161,7 +162,7 @@ public function test_inCaseAFixtureHasAnUnexistenDependencyOrIfItWasntLoaded_thr
class DependentFixture1 implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -172,7 +173,7 @@ public function getDependencies()
class DependentFixture2 implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -183,7 +184,7 @@ public function getDependencies()
class DependentFixture3 implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -194,13 +195,13 @@ public function getDependencies()
class BaseParentFixture1 implements FixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
}
class CountryFixture implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -213,7 +214,7 @@ public function getDependencies()
class StateFixture implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -227,7 +228,7 @@ public function getDependencies()
class AddressFixture implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -242,7 +243,7 @@ public function getDependencies()
class ContactMethodFixture implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -255,7 +256,7 @@ public function getDependencies()
class ContactFixture implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -269,7 +270,7 @@ public function getDependencies()
class CircularReferenceFixture implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -282,7 +283,7 @@ public function getDependencies()
class CircularReferenceFixture2 implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -295,7 +296,7 @@ public function getDependencies()
class CircularReferenceFixture3 implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -308,7 +309,7 @@ public function getDependencies()
class FixtureWithItselfAsParent implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -321,7 +322,7 @@ public function getDependencies()
class FixtureWithUnexistentDependency implements FixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getDependencies()
@@ -334,7 +335,7 @@ public function getDependencies()
class FixtureImplementingBothOrderingInterfaces implements FixtureInterface, OrderedFixtureInterface, DependentFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getOrder()
@@ -352,7 +353,7 @@ public function getDependencies()
class OrderedByNumberFixture1 implements FixtureInterface, OrderedFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getOrder()
@@ -363,7 +364,7 @@ public function getOrder()
class OrderedByNumberFixture2 implements FixtureInterface, OrderedFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getOrder()
@@ -374,7 +375,7 @@ public function getOrder()
class OrderedByNumberFixture3 implements FixtureInterface, OrderedFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getOrder()
View
13 tests/Doctrine/Tests/Common/DataFixtures/Executor/ORMExecutorTest.php
@@ -35,7 +35,7 @@ class ORMExecutorTest extends BaseTest
{
public function testExecuteWithNoPurge()
{
- $em = $this->getMockEntityManager();
+ $em = $this->getMockSqliteEntityManager();
$purger = $this->getMockPurger();
$purger->expects($this->once())
->method('setEntityManager')
@@ -50,7 +50,7 @@ public function testExecuteWithNoPurge()
public function testExecuteWithPurge()
{
- $em = $this->getMockEntityManager();
+ $em = $this->getMockSqliteEntityManager();
$purger = $this->getMockPurger();
$purger->expects($this->once())
->method('purge')
@@ -65,16 +65,11 @@ public function testExecuteWithPurge()
public function testExecuteTransaction()
{
- $em = $this->getMockEntityManager();
+ $em = $this->getMockSqliteEntityManager();
$executor = new ORMExecutor($em);
$fixture = $this->getMockFixture($em);
$executor->execute(array($fixture), true);
}
-
- public function testSharedFixtureExecution()
- {
- $em = $this->getMockEntityManager();
- }
private function getMockFixture($em)
{
@@ -85,4 +80,4 @@ private function getMockPurger()
{
return $this->getMock('Doctrine\Common\DataFixtures\Purger\ORMPurger');
}
-}
+}
View
7 tests/Doctrine/Tests/Common/DataFixtures/FixtureTest.php
@@ -22,6 +22,7 @@
require_once __DIR__.'/TestInit.php';
use Doctrine\Common\DataFixtures\FixtureInterface;
+use Doctrine\Common\Persistence\ObjectManager;
/**
* Test Fixture interface.
@@ -32,7 +33,7 @@ class FixtureTest extends BaseTest
{
public function testFixtureInterface()
{
- $em = $this->getMockEntityManager();
+ $em = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
$fixture = new MyFixture2();
$fixture->load($em);
@@ -44,8 +45,8 @@ class MyFixture2 implements FixtureInterface
{
public $loaded = false;
- public function load($manager)
+ public function load(ObjectManager $manager)
{
$this->loaded = true;
}
-}
+}
View
9 tests/Doctrine/Tests/Common/DataFixtures/OrderedFixtureTest.php
@@ -22,6 +22,7 @@
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\FixtureInterface;
+use Doctrine\Common\Persistence\ObjectManager;
require_once __DIR__.'/TestInit.php';
@@ -51,7 +52,7 @@ public function testFixtureOrder()
class OrderedFixture1 implements FixtureInterface, OrderedFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getOrder()
@@ -62,7 +63,7 @@ public function getOrder()
class OrderedFixture2 implements FixtureInterface, OrderedFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getOrder()
@@ -73,7 +74,7 @@ public function getOrder()
class OrderedFixture3 implements FixtureInterface, OrderedFixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
public function getOrder()
@@ -84,6 +85,6 @@ public function getOrder()
class BaseFixture1 implements FixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{}
}
View
5 tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/MyFixture1.php
@@ -3,10 +3,11 @@
namespace TestFixtures;
use Doctrine\Common\DataFixtures\FixtureInterface;
+use Doctrine\Common\Persistence\ObjectManager;
class MyFixture1 implements FixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{
}
-}
+}
View
5 tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/MyFixture2.php
@@ -3,10 +3,11 @@
namespace TestFixtures;
use Doctrine\Common\DataFixtures\FixtureInterface;
+use Doctrine\Common\Persistence\ObjectManager;
class MyFixture2 implements FixtureInterface
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{
}
-}
+}
View
5 tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/RoleFixture.php
@@ -5,6 +5,7 @@
use Doctrine\Common\DataFixtures\SharedFixtureInterface;
use Doctrine\Common\DataFixtures\ReferenceRepository;
use Doctrine\Tests\Common\DataFixtures\TestEntity\Role;
+use Doctrine\Common\Persistence\ObjectManager;
class RoleFixture implements SharedFixtureInterface
{
@@ -15,7 +16,7 @@ public function setReferenceRepository(ReferenceRepository $referenceRepository)
$this->referenceRepository = $referenceRepository;
}
- public function load($manager)
+ public function load(ObjectManager $manager)
{
$adminRole = new Role();
$adminRole->setName('admin');
@@ -24,4 +25,4 @@ public function load($manager)
$this->referenceRepository->addReference('admin-role', $adminRole);
$manager->flush();
}
-}
+}
View
5 tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/UserFixture.php
@@ -3,10 +3,11 @@
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Tests\Common\DataFixtures\TestEntity\User;
+use Doctrine\Common\Persistence\ObjectManager;
class UserFixture extends AbstractFixture
{
- public function load($manager)
+ public function load(ObjectManager $manager)
{
$admin = new User;
$admin->setId(4);
@@ -21,4 +22,4 @@ public function load($manager)
$this->addReference('admin', $admin);
}
-}
+}

0 comments on commit a8f3fdf

Please sign in to comment.
Something went wrong with that request. Please try again.