diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php index b5a8902fd..0b2b0663c 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -28,7 +28,6 @@ use Doctrine\ORM\Cache\QueryCacheKey; use Doctrine\DBAL\Cache\QueryCacheProfile; use Doctrine\ORM\Cache; -use Doctrine\ORM\Query\QueryException; /** * Base contract for ORM queries. Base class for Query and NativeQuery. diff --git a/lib/Doctrine/ORM/Cache/DefaultQueryCache.php b/lib/Doctrine/ORM/Cache/DefaultQueryCache.php index 83fc0d946..07c9d8f43 100644 --- a/lib/Doctrine/ORM/Cache/DefaultQueryCache.php +++ b/lib/Doctrine/ORM/Cache/DefaultQueryCache.php @@ -234,7 +234,6 @@ class DefaultQueryCache implements QueryCache $data = array(); $entityName = reset($rsm->aliasMap); $hasRelation = ( ! empty($rsm->relationMap)); - $metadata = $this->em->getClassMetadata($entityName); $persister = $this->uow->getEntityPersister($entityName); if ( ! ($persister instanceof CachedPersister)) { diff --git a/lib/Doctrine/ORM/Cache/EntityCacheEntry.php b/lib/Doctrine/ORM/Cache/EntityCacheEntry.php index 3c552073d..155618be9 100644 --- a/lib/Doctrine/ORM/Cache/EntityCacheEntry.php +++ b/lib/Doctrine/ORM/Cache/EntityCacheEntry.php @@ -71,7 +71,7 @@ class EntityCacheEntry implements CacheEntry /** * Retrieves the entity data resolving cache entries * - * @param \Doctrine\ORM\EntityManagerInterfac $em + * @param \Doctrine\ORM\EntityManagerInterface $em * * @return array */ diff --git a/lib/Doctrine/ORM/EntityRepository.php b/lib/Doctrine/ORM/EntityRepository.php index 6a60d5050..08b2ff193 100644 --- a/lib/Doctrine/ORM/EntityRepository.php +++ b/lib/Doctrine/ORM/EntityRepository.php @@ -19,7 +19,6 @@ namespace Doctrine\ORM; -use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query\ResultSetMappingBuilder; use Doctrine\Common\Persistence\ObjectRepository; use Doctrine\Common\Collections\Selectable; diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index 3cedaada0..8e45117ab 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -24,9 +24,6 @@ use PDO; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\PersistentCollection; use Doctrine\ORM\Query; -use Doctrine\ORM\Events; -use Doctrine\ORM\Event\LifecycleEventArgs; -use Doctrine\ORM\Event\PostLoadEventDispatcher; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Proxy\Proxy; diff --git a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php index 1c21369e3..92c77ddd3 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php @@ -20,7 +20,6 @@ namespace Doctrine\ORM\Internal\Hydration; use PDO; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Query; diff --git a/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php b/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php index 25c03a450..525ab34b3 100644 --- a/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php @@ -21,7 +21,6 @@ namespace Doctrine\ORM\Persisters\Collection; use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Persisters\SqlExpressionVisitor; use Doctrine\ORM\Persisters\SqlValueVisitor; use Doctrine\ORM\PersistentCollection; use Doctrine\ORM\Query; @@ -740,7 +739,7 @@ class ManyToManyPersister extends AbstractCollectionPersister $valueVisitor->dispatch($expression); - list($values, $types) = $valueVisitor->getParamsAndTypes(); + list(, $types) = $valueVisitor->getParamsAndTypes(); return $types; } diff --git a/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php b/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php index d4213f15d..0e2fda868 100644 --- a/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php @@ -20,7 +20,6 @@ namespace Doctrine\ORM\Persisters\Collection; use Doctrine\Common\Collections\Criteria; -use Doctrine\Common\Proxy\Proxy; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\PersistentCollection; use Doctrine\ORM\Utility\PersisterHelper; diff --git a/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php b/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php index 072407405..0975cf56e 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php @@ -20,7 +20,6 @@ namespace Doctrine\ORM\Persisters\Entity; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\DBAL\LockMode; use Doctrine\DBAL\Types\Type; diff --git a/lib/Doctrine/ORM/Query/Parser.php b/lib/Doctrine/ORM/Query/Parser.php index 8b6feaf83..7619359ce 100644 --- a/lib/Doctrine/ORM/Query/Parser.php +++ b/lib/Doctrine/ORM/Query/Parser.php @@ -2953,7 +2953,7 @@ class Parser /** * EntityExpression ::= SingleValuedAssociationPathExpression | SimpleEntityExpression * - * @return \Doctrine\ORM\Query\AST\SingleValuedAssociationPathExpression | + * @return \Doctrine\ORM\Query\AST\PathExpression | * \Doctrine\ORM\Query\AST\SimpleEntityExpression */ public function EntityExpression() diff --git a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php index 97bfb4709..73eb5ae5a 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php +++ b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php @@ -19,7 +19,6 @@ namespace Doctrine\ORM\Query; -use Doctrine\DBAL\Types\Type; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Mapping\MappingException; diff --git a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php index fc431227f..92386e46d 100644 --- a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php +++ b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php @@ -18,18 +18,9 @@ use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\PostgreSqlPlatform; use Doctrine\DBAL\Platforms\SQLAnywherePlatform; use Doctrine\DBAL\Platforms\SQLServerPlatform; -use Doctrine\ORM\Query\AST\ArithmeticExpression; -use Doctrine\ORM\Query\AST\ArithmeticFactor; -use Doctrine\ORM\Query\AST\ArithmeticTerm; -use Doctrine\ORM\Query\AST\Literal; use Doctrine\ORM\Query\AST\OrderByClause; -use Doctrine\ORM\Query\AST\OrderByItem; use Doctrine\ORM\Query\AST\PartialObjectExpression; -use Doctrine\ORM\Query\AST\PathExpression; use Doctrine\ORM\Query\AST\SelectExpression; -use Doctrine\ORM\Query\AST\SimpleArithmeticExpression; -use Doctrine\ORM\Query\Expr\OrderBy; -use Doctrine\ORM\Query\Expr\Select; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\AST\SelectStatement; diff --git a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php index d65ab6cfe..fd51fb46b 100644 --- a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php +++ b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php @@ -20,7 +20,6 @@ namespace Doctrine\ORM\Tools\Pagination; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Mapping\ClassMetadataInfo; -use Doctrine\ORM\ORMException; use Doctrine\ORM\Query; use Doctrine\ORM\Query\TreeWalkerAdapter; use Doctrine\ORM\Query\AST\Functions\IdentityFunction; diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 7d7da9754..a66d7b462 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -49,7 +49,6 @@ use Doctrine\ORM\Persisters\Entity\JoinedSubclassPersister; use Doctrine\ORM\Persisters\Collection\OneToManyPersister; use Doctrine\ORM\Persisters\Collection\ManyToManyPersister; use Doctrine\ORM\Utility\IdentifierFlattener; -use Doctrine\ORM\Cache\AssociationCacheEntry; /** * The UnitOfWork is responsible for tracking changes to objects during an @@ -1281,7 +1280,7 @@ class UnitOfWork implements PropertyChangedListener $extraUpdate = array($entity, $changeset); if (isset($this->extraUpdates[$oid])) { - list($ignored, $changeset2) = $this->extraUpdates[$oid]; + list(, $changeset2) = $this->extraUpdates[$oid]; $extraUpdate = array($entity, $changeset + $changeset2); } diff --git a/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php b/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php index deab5239a..599c4996f 100644 --- a/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php +++ b/tests/Doctrine/Tests/Mocks/ClassMetadataMock.php @@ -2,10 +2,12 @@ namespace Doctrine\Tests\Mocks; +use Doctrine\ORM\Mapping\ClassMetadata; + /** * Mock class for ClassMetadata. */ -class ClassMetadataMock extends \Doctrine\ORM\Mapping\ClassMetadata +class ClassMetadataMock extends ClassMetadata { /* Mock API */ diff --git a/tests/Doctrine/Tests/Mocks/ConnectionMock.php b/tests/Doctrine/Tests/Mocks/ConnectionMock.php index 5cf9dae4d..49ca3e4ea 100644 --- a/tests/Doctrine/Tests/Mocks/ConnectionMock.php +++ b/tests/Doctrine/Tests/Mocks/ConnectionMock.php @@ -1,11 +1,12 @@ _schemaManagerMock == null) { return new SchemaManagerMock($conn); @@ -55,7 +60,7 @@ class DriverMock implements \Doctrine\DBAL\Driver * * @return void */ - public function setDatabasePlatform(\Doctrine\DBAL\Platforms\AbstractPlatform $platform) + public function setDatabasePlatform(AbstractPlatform $platform) { $this->_platformMock = $platform; } @@ -65,7 +70,7 @@ class DriverMock implements \Doctrine\DBAL\Driver * * @return void */ - public function setSchemaManager(\Doctrine\DBAL\Schema\AbstractSchemaManager $sm) + public function setSchemaManager(AbstractSchemaManager $sm) { $this->_schemaManagerMock = $sm; } @@ -81,7 +86,7 @@ class DriverMock implements \Doctrine\DBAL\Driver /** * {@inheritdoc} */ - public function getDatabase(\Doctrine\DBAL\Connection $conn) + public function getDatabase(Connection $conn) { return; } diff --git a/tests/Doctrine/Tests/Mocks/EntityManagerMock.php b/tests/Doctrine/Tests/Mocks/EntityManagerMock.php index 74f4efcf0..24ecb59ef 100644 --- a/tests/Doctrine/Tests/Mocks/EntityManagerMock.php +++ b/tests/Doctrine/Tests/Mocks/EntityManagerMock.php @@ -21,12 +21,14 @@ namespace Doctrine\Tests\Mocks; -use Doctrine\ORM\Proxy\ProxyFactory; +use Doctrine\Common\EventManager; +use Doctrine\ORM\Configuration; +use Doctrine\ORM\EntityManager; /** * Special EntityManager mock used for testing purposes. */ -class EntityManagerMock extends \Doctrine\ORM\EntityManager +class EntityManagerMock extends EntityManager { /** * @var \Doctrine\ORM\UnitOfWork|null @@ -83,17 +85,16 @@ class EntityManagerMock extends \Doctrine\ORM\EntityManager * * {@inheritdoc} */ - public static function create($conn, \Doctrine\ORM\Configuration $config = null, - \Doctrine\Common\EventManager $eventManager = null) + public static function create($conn, Configuration $config = null, EventManager $eventManager = null) { if (null === $config) { - $config = new \Doctrine\ORM\Configuration(); + $config = new Configuration(); $config->setProxyDir(__DIR__ . '/../Proxies'); $config->setProxyNamespace('Doctrine\Tests\Proxies'); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(array(), true)); } if (null === $eventManager) { - $eventManager = new \Doctrine\Common\EventManager(); + $eventManager = new EventManager(); } return new EntityManagerMock($conn, $config, $eventManager); diff --git a/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php b/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php index 761ec4bc1..6130f58f3 100644 --- a/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php +++ b/tests/Doctrine/Tests/Mocks/EntityPersisterMock.php @@ -3,11 +3,13 @@ namespace Doctrine\Tests\Mocks; use Doctrine\Common\Collections\Criteria; +use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\Persisters\Entity\BasicEntityPersister; /** * EntityPersister implementation used for mocking during tests. */ -class EntityPersisterMock extends \Doctrine\ORM\Persisters\Entity\BasicEntityPersister +class EntityPersisterMock extends BasicEntityPersister { /** * @var array @@ -52,7 +54,7 @@ class EntityPersisterMock extends \Doctrine\ORM\Persisters\Entity\BasicEntityPer public function addInsert($entity) { $this->inserts[] = $entity; - if ( ! is_null($this->mockIdGeneratorType) && $this->mockIdGeneratorType == \Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_IDENTITY + if ( ! is_null($this->mockIdGeneratorType) && $this->mockIdGeneratorType == ClassMetadata::GENERATOR_TYPE_IDENTITY || $this->class->isIdGeneratorIdentity()) { $id = $this->identityColumnValueCounter++; $this->postInsertIds[] = array( diff --git a/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php b/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php index 5930db12c..7afec2c60 100644 --- a/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php +++ b/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php @@ -2,13 +2,15 @@ namespace Doctrine\Tests\Mocks; +use Doctrine\DBAL\Driver\Statement; + /** * This class is a mock of the Statement interface that can be passed in to the Hydrator * to test the hydration standalone with faked result sets. * * @author Roman Borschel */ -class HydratorMockStatement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement +class HydratorMockStatement implements \IteratorAggregate, Statement { /** * @var array diff --git a/tests/Doctrine/Tests/Mocks/MetadataDriverMock.php b/tests/Doctrine/Tests/Mocks/MetadataDriverMock.php index 21339c5f9..b691ec02c 100644 --- a/tests/Doctrine/Tests/Mocks/MetadataDriverMock.php +++ b/tests/Doctrine/Tests/Mocks/MetadataDriverMock.php @@ -2,15 +2,18 @@ namespace Doctrine\Tests\Mocks; +use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; + /** * Mock class for MappingDriver. */ -class MetadataDriverMock implements \Doctrine\Common\Persistence\Mapping\Driver\MappingDriver +class MetadataDriverMock implements MappingDriver { /** * {@inheritdoc} */ - public function loadMetadataForClass($className, \Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata) + public function loadMetadataForClass($className, ClassMetadata $metadata) { } diff --git a/tests/Doctrine/Tests/Mocks/MockTreeWalker.php b/tests/Doctrine/Tests/Mocks/MockTreeWalker.php index fd6c81815..0edb8581a 100644 --- a/tests/Doctrine/Tests/Mocks/MockTreeWalker.php +++ b/tests/Doctrine/Tests/Mocks/MockTreeWalker.php @@ -2,10 +2,12 @@ namespace Doctrine\Tests\Mocks; +use Doctrine\ORM\Query\TreeWalkerAdapter; + /** * Mock class for TreeWalker. */ -class MockTreeWalker extends \Doctrine\ORM\Query\TreeWalkerAdapter +class MockTreeWalker extends TreeWalkerAdapter { /** * {@inheritdoc} diff --git a/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php b/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php index 02c7c0a79..5de33a049 100644 --- a/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php +++ b/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php @@ -2,15 +2,18 @@ namespace Doctrine\Tests\Mocks; +use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Schema\AbstractSchemaManager; + /** * Mock class for AbstractSchemaManager. */ -class SchemaManagerMock extends \Doctrine\DBAL\Schema\AbstractSchemaManager +class SchemaManagerMock extends AbstractSchemaManager { /** * @param \Doctrine\DBAL\Connection $conn */ - public function __construct(\Doctrine\DBAL\Connection $conn) + public function __construct(Connection $conn) { parent::__construct($conn); } diff --git a/tests/Doctrine/Tests/Mocks/SequenceMock.php b/tests/Doctrine/Tests/Mocks/SequenceMock.php index 4f5123004..fc6c10f41 100644 --- a/tests/Doctrine/Tests/Mocks/SequenceMock.php +++ b/tests/Doctrine/Tests/Mocks/SequenceMock.php @@ -3,11 +3,12 @@ namespace Doctrine\Tests\Mocks; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\Id\SequenceGenerator; /** * Mock class for SequenceGenerator. */ -class SequenceMock extends \Doctrine\ORM\Id\SequenceGenerator +class SequenceMock extends SequenceGenerator { /** * @var int diff --git a/tests/Doctrine/Tests/Mocks/StatementMock.php b/tests/Doctrine/Tests/Mocks/StatementMock.php index 40ad1f3e5..8107ff1be 100644 --- a/tests/Doctrine/Tests/Mocks/StatementMock.php +++ b/tests/Doctrine/Tests/Mocks/StatementMock.php @@ -2,12 +2,14 @@ namespace Doctrine\Tests\Mocks; +use Doctrine\DBAL\Driver\Statement; + /** * This class is a mock of the Statement interface. * * @author Alexander */ -class StatementMock implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement +class StatementMock implements \IteratorAggregate, Statement { /** * {@inheritdoc} diff --git a/tests/Doctrine/Tests/Mocks/UnitOfWorkMock.php b/tests/Doctrine/Tests/Mocks/UnitOfWorkMock.php index c846bca1c..3d7361e7f 100644 --- a/tests/Doctrine/Tests/Mocks/UnitOfWorkMock.php +++ b/tests/Doctrine/Tests/Mocks/UnitOfWorkMock.php @@ -2,10 +2,12 @@ namespace Doctrine\Tests\Mocks; +use Doctrine\ORM\UnitOfWork; + /** * Mock class for UnitOfWork. */ -class UnitOfWorkMock extends \Doctrine\ORM\UnitOfWork +class UnitOfWorkMock extends UnitOfWork { /** * @var array diff --git a/tests/Doctrine/Tests/Models/DDC3579/DDC3579Admin.php b/tests/Doctrine/Tests/Models/DDC3579/DDC3579Admin.php index cc9803d44..effedc3c4 100644 --- a/tests/Doctrine/Tests/Models/DDC3579/DDC3579Admin.php +++ b/tests/Doctrine/Tests/Models/DDC3579/DDC3579Admin.php @@ -2,8 +2,6 @@ namespace Doctrine\Tests\Models\DDC3579; -use Doctrine\Common\Collections\ArrayCollection; - /** * @Entity * @AssociationOverrides({ diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753InvalidRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753InvalidRepository.php index 9f0937aa1..decc07078 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753InvalidRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753InvalidRepository.php @@ -20,8 +20,6 @@ namespace Doctrine\Tests\Models\DDC753; -use Doctrine\ORM\EntityRepository; - class DDC753InvalidRepository { diff --git a/tests/Doctrine/Tests/Models/DDC964/DDC964Admin.php b/tests/Doctrine/Tests/Models/DDC964/DDC964Admin.php index 464471b31..110326b2c 100644 --- a/tests/Doctrine/Tests/Models/DDC964/DDC964Admin.php +++ b/tests/Doctrine/Tests/Models/DDC964/DDC964Admin.php @@ -2,8 +2,6 @@ namespace Doctrine\Tests\Models\DDC964; -use Doctrine\Common\Collections\ArrayCollection; - /** * @Entity * @AssociationOverrides({ diff --git a/tests/Doctrine/Tests/Models/DDC964/DDC964Guest.php b/tests/Doctrine/Tests/Models/DDC964/DDC964Guest.php index 935ee59c0..cb64d15fa 100644 --- a/tests/Doctrine/Tests/Models/DDC964/DDC964Guest.php +++ b/tests/Doctrine/Tests/Models/DDC964/DDC964Guest.php @@ -2,8 +2,6 @@ namespace Doctrine\Tests\Models\DDC964; -use Doctrine\Common\Collections\ArrayCollection; - /** * @Entity * @AttributeOverrides({ diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php index ac3834145..4b955be91 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php @@ -2,8 +2,6 @@ namespace Doctrine\Tests\Models\Legacy; -use Doctrine\Common\Collections\ArrayCollection; - /** * @Entity * @Table(name="legacy_cars") diff --git a/tests/Doctrine/Tests/Models/StockExchange/Bond.php b/tests/Doctrine/Tests/Models/StockExchange/Bond.php index a93586f5e..a0d37bfe8 100644 --- a/tests/Doctrine/Tests/Models/StockExchange/Bond.php +++ b/tests/Doctrine/Tests/Models/StockExchange/Bond.php @@ -1,7 +1,6 @@ 'foo')); - $region1 = new DefaultRegion('region1', new \Doctrine\Common\Cache\ApcCache()); - $region2 = new DefaultRegion('region2', new \Doctrine\Common\Cache\ApcCache()); + $region1 = new DefaultRegion('region1', new ApcCache()); + $region2 = new DefaultRegion('region2', new ApcCache()); $this->assertFalse($region1->contains($key)); $this->assertFalse($region2->contains($key)); diff --git a/tests/Doctrine/Tests/ORM/Cache/MultiGetRegionTest.php b/tests/Doctrine/Tests/ORM/Cache/MultiGetRegionTest.php index 091ec672a..65d21b93f 100644 --- a/tests/Doctrine/Tests/ORM/Cache/MultiGetRegionTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/MultiGetRegionTest.php @@ -2,12 +2,10 @@ namespace Doctrine\Tests\ORM\Cache; -use Doctrine\Common\Cache\ArrayCache; use Doctrine\Tests\Mocks\CacheEntryMock; use Doctrine\Tests\Mocks\CacheKeyMock; use Doctrine\ORM\Cache\Region\DefaultMultiGetRegion; use Doctrine\ORM\Cache\CollectionCacheEntry; -use Doctrine\ORM\Cache\EntityCacheKey; /** * @author Asmir Mustafic diff --git a/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php b/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php index 0d767aca9..e93924d4a 100644 --- a/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php @@ -2,6 +2,7 @@ namespace Doctrine\Tests\ORM\Cache\Persister\Collection; +use Doctrine\ORM\PersistentCollection; use Doctrine\Tests\OrmTestCase; use Doctrine\ORM\Cache\Region; @@ -101,7 +102,7 @@ abstract class AbstractCollectionPersisterTest extends OrmTestCase $em = $this->em; $class = $class ?: $this->em->getClassMetadata('Doctrine\Tests\Models\Cache\State'); $assoc = $assoc ?: $class->associationMappings['cities']; - $coll = new \Doctrine\ORM\PersistentCollection($em, $class, $elements ?: new ArrayCollection); + $coll = new PersistentCollection($em, $class, $elements ?: new ArrayCollection); $coll->setOwner($owner, $assoc); $coll->setInitialized(true); diff --git a/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php b/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php index e9bf04459..770ec7deb 100644 --- a/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php +++ b/tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM; use Doctrine\ORM\Internal\CommitOrderCalculator; use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\Tests\OrmTestCase; /** * Tests of the commit order calculation. @@ -12,7 +13,7 @@ use Doctrine\ORM\Mapping\ClassMetadata; * can have many valid orderings, so you may want to build a graph that has only * 1 valid order to simplify your tests. */ -class CommitOrderCalculatorTest extends \Doctrine\Tests\OrmTestCase +class CommitOrderCalculatorTest extends OrmTestCase { private $_calc; diff --git a/tests/Doctrine/Tests/ORM/ConfigurationTest.php b/tests/Doctrine/Tests/ORM/ConfigurationTest.php index cb9ec66be..0431eff39 100644 --- a/tests/Doctrine/Tests/ORM/ConfigurationTest.php +++ b/tests/Doctrine/Tests/ORM/ConfigurationTest.php @@ -6,7 +6,6 @@ use Doctrine\Common\Proxy\AbstractProxyFactory; use Doctrine\Common\Cache\ArrayCache; use Doctrine\ORM\Mapping as AnnotationNamespace; use Doctrine\ORM\Configuration; -use Doctrine\ORM\ORMException; use ReflectionClass; use PHPUnit_Framework_TestCase; diff --git a/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php b/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php index 849f579fa..fb2c4ea42 100644 --- a/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php +++ b/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php @@ -2,8 +2,6 @@ namespace Doctrine\Tests\ORM\Decorator; -use Doctrine\ORM\Decorator\EntityManagerDecorator; -use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query\ResultSetMapping; class EntityManagerDecoratorTest extends \PHPUnit_Framework_TestCase diff --git a/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php b/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php index 4cf98ec5e..117525eca 100644 --- a/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php +++ b/tests/Doctrine/Tests/ORM/Entity/ConstructorTest.php @@ -2,7 +2,9 @@ namespace Doctrine\Tests\ORM\Entity; -class ConstructorTest extends \Doctrine\Tests\OrmTestCase +use Doctrine\Tests\OrmTestCase; + +class ConstructorTest extends OrmTestCase { public function testFieldInitializationInConstructor() { diff --git a/tests/Doctrine/Tests/ORM/EntityManagerTest.php b/tests/Doctrine/Tests/ORM/EntityManagerTest.php index 37a444a60..797e60173 100644 --- a/tests/Doctrine/Tests/ORM/EntityManagerTest.php +++ b/tests/Doctrine/Tests/ORM/EntityManagerTest.php @@ -2,7 +2,10 @@ namespace Doctrine\Tests\ORM; -class EntityManagerTest extends \Doctrine\Tests\OrmTestCase +use Doctrine\ORM\Query\ResultSetMapping; +use Doctrine\Tests\OrmTestCase; + +class EntityManagerTest extends OrmTestCase { private $_em; @@ -54,7 +57,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase public function testCreateNativeQuery() { - $rsm = new \Doctrine\ORM\Query\ResultSetMapping(); + $rsm = new ResultSetMapping(); $query = $this->_em->createNativeQuery('SELECT foo', $rsm); $this->assertSame('SELECT foo', $query->getSql()); @@ -65,7 +68,7 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase */ public function testCreateNamedNativeQuery() { - $rsm = new \Doctrine\ORM\Query\ResultSetMapping(); + $rsm = new ResultSetMapping(); $this->_em->getConfiguration()->addNamedNativeQuery('foo', 'SELECT foo', $rsm); $query = $this->_em->createNamedNativeQuery('foo'); diff --git a/tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php b/tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php index 7302a1d6f..67038a781 100644 --- a/tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php @@ -4,7 +4,6 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Tests\Models\Company\CompanyEmployee, Doctrine\Tests\Models\Company\CompanyManager, - Doctrine\Tests\Models\Company\CompanyPerson, Doctrine\Tests\Models\Company\CompanyCar; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php index 29f8fab85..42a75be14 100644 --- a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php @@ -2,12 +2,10 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Query; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\CMS\CmsPhonenumber; use Doctrine\Tests\Models\CMS\CmsAddress; -use Doctrine\Tests\Models\CMS\CmsGroup; use Doctrine\Tests\Models\CMS\CmsArticle; use Doctrine\Tests\Models\CMS\CmsComment; diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php index 9fa1cb8af..f8dd3b7a5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php @@ -6,10 +6,8 @@ use Doctrine\Tests\Models\Company\CompanyPerson, Doctrine\Tests\Models\Company\CompanyEmployee, Doctrine\Tests\Models\Company\CompanyManager, Doctrine\Tests\Models\Company\CompanyOrganization, - Doctrine\Tests\Models\Company\CompanyEvent, Doctrine\Tests\Models\Company\CompanyAuction, - Doctrine\Tests\Models\Company\CompanyRaffle, - Doctrine\Tests\Models\Company\CompanyCar; + Doctrine\Tests\Models\Company\CompanyRaffle; use Doctrine\Common\Collections\Criteria; diff --git a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php index 85d588880..bc6c0cdd7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php @@ -6,7 +6,6 @@ use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\CMS\CmsPhonenumber; use Doctrine\Tests\Models\CMS\CmsAddress; use Doctrine\Tests\Models\CMS\CmsArticle; -use Doctrine\ORM\UnitOfWork; /** * Description of DetachedEntityTest diff --git a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php index 705802306..8e20d570a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php @@ -5,7 +5,6 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\CMS\CmsEmail; use Doctrine\Tests\Models\CMS\CmsAddress; -use Doctrine\Tests\Models\CMS\CmsPhonenumber; use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\ArrayCollection; diff --git a/tests/Doctrine/Tests/ORM/Functional/HydrationCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/HydrationCacheTest.php index 9dc556d4b..dc84ac4ed 100644 --- a/tests/Doctrine/Tests/ORM/Functional/HydrationCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/HydrationCacheTest.php @@ -1,4 +1,5 @@ name = "Benjamin"; $user->username = "beberlei"; $user->status = 'active'; diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php index c7bdf6bf8..e69d3ee6a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/GearmanLockTest.php @@ -2,15 +2,14 @@ namespace Doctrine\Tests\ORM\Functional\Locking; -use Doctrine\Tests\Models\CMS\CmsArticle, - Doctrine\Tests\Models\CMS\CmsUser, - Doctrine\DBAL\LockMode, - Doctrine\ORM\EntityManager; +use Doctrine\Tests\Models\CMS\CmsArticle; +use Doctrine\DBAL\LockMode; +use Doctrine\Tests\OrmFunctionalTestCase; /** * @group locking_functional */ -class GearmanLockTest extends \Doctrine\Tests\OrmFunctionalTestCase +class GearmanLockTest extends OrmFunctionalTestCase { private $gearman = null; private $maxRunTime = 0; diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php index c2d3c7315..1face5f31 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php @@ -4,8 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Locking; use Doctrine\Tests\Models\CMS\CmsArticle, Doctrine\Tests\Models\CMS\CmsUser, - Doctrine\DBAL\LockMode, - Doctrine\ORM\EntityManager; + Doctrine\DBAL\LockMode; /** * @group locking diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php index df55bd798..e4cad5171 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php @@ -2,15 +2,12 @@ namespace Doctrine\Tests\ORM\Functional\Locking; -use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\OptimisticLockException; -use Doctrine\Common\EventManager; -use Doctrine\ORM\Mapping\ClassMetadataFactory; -use Doctrine\Tests\TestUtil; use Doctrine\DBAL\LockMode; use DateTime; +use Doctrine\Tests\OrmFunctionalTestCase; -class OptimisticTest extends \Doctrine\Tests\OrmFunctionalTestCase +class OptimisticTest extends OrmFunctionalTestCase { protected function setUp() { diff --git a/tests/Doctrine/Tests/ORM/Functional/MergeVersionedManyToOneTest.php b/tests/Doctrine/Tests/ORM/Functional/MergeVersionedManyToOneTest.php index b534a5cb4..43af6720c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/MergeVersionedManyToOneTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/MergeVersionedManyToOneTest.php @@ -2,15 +2,14 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\ORM\OptimisticLockException; -use Doctrine\ORM\ORMException; use Doctrine\Tests\Models\VersionedManyToOne\Article; use Doctrine\Tests\Models\VersionedManyToOne\Category; +use Doctrine\Tests\OrmFunctionalTestCase; /** * @group MergeVersionedOneToMany */ -class MergeVersionedManyToOneTest extends \Doctrine\Tests\OrmFunctionalTestCase +class MergeVersionedManyToOneTest extends OrmFunctionalTestCase { protected function setUp() { diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManyOrphanRemovalTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManyOrphanRemovalTest.php index e10c1f923..345d6190c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManyOrphanRemovalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManyOrphanRemovalTest.php @@ -3,7 +3,6 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Tests\Models\CMS\CmsUser, - Doctrine\Tests\Models\CMS\CmsAddress, Doctrine\Tests\Models\CMS\CmsPhonenumber; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneOrphanRemovalTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneOrphanRemovalTest.php index 98e307800..528bf56b3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneOrphanRemovalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneOrphanRemovalTest.php @@ -4,8 +4,7 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Tests\Models\CMS\CmsUser, Doctrine\Tests\Models\CMS\CmsEmail, - Doctrine\Tests\Models\CMS\CmsAddress, - Doctrine\Tests\Models\CMS\CmsPhonenumber; + Doctrine\Tests\Models\CMS\CmsAddress; /** * Tests a bidirectional one-to-one association mapping with orphan removal. diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneSingleTableInheritanceTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneSingleTableInheritanceTest.php index af9379327..b677df624 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneSingleTableInheritanceTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneSingleTableInheritanceTest.php @@ -2,10 +2,6 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\Tests\Models\ECommerce\ECommerceProduct; -use Doctrine\Tests\Models\ECommerce\ECommerceShipping; -use Doctrine\ORM\Mapping\AssociationMapping; -use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Query; use Doctrine\Tests\Models\OneToOneSingleTableInheritance\Cat; use Doctrine\Tests\Models\OneToOneSingleTableInheritance\LitterBox; diff --git a/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php b/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php index 592706588..1528404df 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ProxiesLikeEntitiesTest.php @@ -2,8 +2,8 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\Common\Util\ClassUtils; use Doctrine\Tests\Models\CMS\CmsUser; +use Doctrine\Tests\OrmFunctionalTestCase; /** * Test that Doctrine ORM correctly works with proxy instances exactly like with ordinary Entities @@ -13,7 +13,7 @@ use Doctrine\Tests\Models\CMS\CmsUser; * b) __initialized__ = false and identifier set in proxy and in property * @todo All other cases would cause lazy loading */ -class ProxiesLikeEntitiesTest extends \Doctrine\Tests\OrmFunctionalTestCase +class ProxiesLikeEntitiesTest extends OrmFunctionalTestCase { /** * @var CmsUser diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php index 039bb1655..f84147374 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php @@ -2,7 +2,6 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Common\Cache\ArrayCache; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php index 2e6dbc3c6..922c463a9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php @@ -4,7 +4,6 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\DBAL\Connection; use Doctrine\Tests\Models\CMS\CmsUser, Doctrine\Tests\Models\CMS\CmsArticle, Doctrine\Tests\Models\CMS\CmsPhonenumber; diff --git a/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php b/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php index 831d0b564..bbf688c46 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php @@ -4,7 +4,7 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\DBAL\Types\Type as DBALType; use Doctrine\ORM\Query\Filter\SQLFilter; -use Doctrine\ORM\Mapping\ClassMetaData; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Common\Cache\ArrayCache; use Doctrine\ORM\Mapping\ClassMetadataInfo; diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php index 0c76edf73..8887a0751 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php @@ -10,7 +10,7 @@ class DBAL483Test extends \Doctrine\Tests\OrmFunctionalTestCase { parent::setUp(); - $conn = $this->_em->getConnection(); + $this->_em->getConnection(); $this->schemaTool = new Tools\SchemaTool($this->_em); } diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php index 4df6032d0..a923c40fc 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php @@ -2,10 +2,10 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool; -use Doctrine\ORM\Tools\SchemaTool, - Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\Tools\SchemaTool; +use Doctrine\Tests\OrmFunctionalTestCase; -class MySqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase +class MySqlSchemaToolTest extends OrmFunctionalTestCase { protected function setUp() { parent::setUp(); diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/PostgreSqlSchemaToolTest.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/PostgreSqlSchemaToolTest.php index 52151e4ba..66e990688 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/PostgreSqlSchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/PostgreSqlSchemaToolTest.php @@ -2,8 +2,7 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool; -use Doctrine\ORM\Tools\SchemaTool, - Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\Tools\SchemaTool; class PostgreSqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase { diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaValidatorTest.php b/tests/Doctrine/Tests/ORM/Functional/SchemaValidatorTest.php index 948aad2ef..c09f336c9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaValidatorTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaValidatorTest.php @@ -2,7 +2,6 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\DBAL\Types\Type as DBALType; use Doctrine\ORM\Tools\SchemaValidator; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToOneTest.php b/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToOneTest.php index e84be7e07..316620f82 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToOneTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToOneTest.php @@ -2,10 +2,8 @@ namespace Doctrine\Tests\ORM\Functional; -use Doctrine\Tests\Models\Cache\Action; use Doctrine\Tests\Models\Cache\Address; use Doctrine\Tests\Models\Cache\Client; -use Doctrine\Tests\Models\Cache\ComplexAction; use Doctrine\Tests\Models\Cache\Person; use Doctrine\Tests\Models\Cache\Token; use Doctrine\Tests\Models\Cache\Traveler; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1040Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1040Test.php index 1b7c5b521..988e8ba99 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1040Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1040Test.php @@ -2,14 +2,14 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Tests\Models\CMS\CmsArticle; use Doctrine\Tests\Models\CMS\CmsUser; +use Doctrine\Tests\OrmFunctionalTestCase; /** * @group DDC-1040 */ -class DDC1040Test extends \Doctrine\Tests\OrmFunctionalTestCase +class DDC1040Test extends OrmFunctionalTestCase { public function setUp() { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1041Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1041Test.php index 0cf14aecc..ee1218187 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1041Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1041Test.php @@ -2,12 +2,13 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Tests\Models\Company\CompanyFixContract; +use Doctrine\Tests\OrmFunctionalTestCase; /** * @group DDC-1041 */ -class DDC1041Test extends \Doctrine\Tests\OrmFunctionalTestCase +class DDC1041Test extends OrmFunctionalTestCase { public function setUp() { @@ -17,7 +18,7 @@ class DDC1041Test extends \Doctrine\Tests\OrmFunctionalTestCase public function testGrabWrongSubtypeReturnsNull() { - $fix = new \Doctrine\Tests\Models\Company\CompanyFixContract(); + $fix = new CompanyFixContract(); $fix->setFixPrice(2000); $this->_em->persist($fix); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1043Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1043Test.php index babb43844..f3e255042 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1043Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1043Test.php @@ -2,12 +2,13 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Tests\Models\CMS\CmsUser; +use Doctrine\Tests\OrmFunctionalTestCase; /** * @group DDC-1043 */ -class DDC1043Test extends \Doctrine\Tests\OrmFunctionalTestCase +class DDC1043Test extends OrmFunctionalTestCase { public function setUp() { @@ -17,7 +18,7 @@ class DDC1043Test extends \Doctrine\Tests\OrmFunctionalTestCase public function testChangeSetPlusWeirdPHPCastingIntCastingRule() { - $user = new \Doctrine\Tests\Models\CMS\CmsUser(); + $user = new CmsUser(); $user->name = "John Galt"; $user->username = "jgalt"; $user->status = "+44"; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php index d95605425..98de7ee38 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1050Test.php @@ -2,12 +2,13 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Tests\Models\CMS\CmsUser; +use Doctrine\Tests\OrmFunctionalTestCase; /** * @group DDC-1050 */ -class DDC1050Test extends \Doctrine\Tests\OrmFunctionalTestCase +class DDC1050Test extends OrmFunctionalTestCase { public function setUp() { @@ -21,7 +22,7 @@ class DDC1050Test extends \Doctrine\Tests\OrmFunctionalTestCase public function testPerformance() { for ($i = 2; $i < 10000; ++$i) { - $user = new \Doctrine\Tests\Models\CMS\CmsUser(); + $user = new CmsUser(); $user->status = 'developer'; $user->username = 'jwage'+$i; $user->name = 'Jonathan'; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1080Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1080Test.php index 500b4e1e1..cd678d5f1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1080Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1080Test.php @@ -2,10 +2,12 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Tests\OrmFunctionalTestCase; + /** * @group DDC-1080 */ -class DDC1080Test extends \Doctrine\Tests\OrmFunctionalTestCase +class DDC1080Test extends OrmFunctionalTestCase { public function testHydration() { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php index 335c89dce..e40f27994 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php @@ -2,8 +2,6 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Common\Collections\ArrayCollection; - /** * @group DDC-1113 * @group DDC-1306 diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1129Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1129Test.php index 70d2e9fea..1f59d07ba 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1129Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1129Test.php @@ -2,8 +2,6 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Common\Collections\ArrayCollection; - /** * @group DDC-1129 */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php index 5a6d2e599..b6d82816c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php @@ -2,7 +2,9 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -class DDC1181Test extends \Doctrine\Tests\OrmFunctionalTestCase +use Doctrine\Tests\OrmFunctionalTestCase; + +class DDC1181Test extends OrmFunctionalTestCase { public function setUp() { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php index 8e77ff0a3..a4ecf5d39 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php @@ -1,9 +1,10 @@ markTestSkipped("PostgreSQL only test."); } - $sql = $this->_schemaTool->getCreateSchemaSQL(array( + $sql = $this->_schemaTool->getCreateSchemaSql(array( $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1360DoubleQuote') )); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php index ad5fc4317..fb6ae25e6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php @@ -1,7 +1,6 @@ _schemaTool->createSchema(array( diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php index 949091f77..42aeca43e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php @@ -10,9 +10,9 @@ use Doctrine\ORM\Query\ResultSetMappingBuilder; */ class DDC2256Test extends \Doctrine\Tests\OrmFunctionalTestCase { - protected function setup() + protected function setUp() { - parent::setup(); + parent::setUp(); $this->_schemaTool->createSchema(array( $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC2256User'), $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC2256Group') diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php index 6a4066c19..ca3ee1a50 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php @@ -12,9 +12,9 @@ class DDC2306Test extends \Doctrine\Tests\OrmFunctionalTestCase /** * {@inheritDoc} */ - protected function setup() + protected function setUp() { - parent::setup(); + parent::setUp(); $this->_schemaTool->createSchema(array( $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC2306Zone'), diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php index 8832b0f50..3d2781763 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php @@ -18,9 +18,9 @@ class DDC2346Test extends \Doctrine\Tests\OrmFunctionalTestCase /** * {@inheritDoc} */ - protected function setup() + protected function setUp() { - parent::setup(); + parent::setUp(); $this->_schemaTool->createSchema(array( $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC2346Foo'), diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php index c1189d797..324e5e7eb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php @@ -2,8 +2,6 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\ORM\Mapping\ClassMetadataFactory; - /** * @group DDC-2359 */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php index 39b918d26..d9dca3752 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php @@ -1,7 +1,10 @@ _schemaTool->createSchema(array( diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2692Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2692Test.php index 94c3d60f0..d52953d60 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2692Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2692Test.php @@ -13,9 +13,9 @@ class DDC2692Test extends \Doctrine\Tests\OrmFunctionalTestCase /** * {@inheritDoc} */ - protected function setup() + protected function setUp() { - parent::setup(); + parent::setUp(); try { $this->_schemaTool->createSchema(array( diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php index a071d4c0c..6198663e6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php @@ -10,9 +10,9 @@ class DDC2759Test extends \Doctrine\Tests\OrmFunctionalTestCase /** * {@inheritDoc} */ - protected function setup() + protected function setUp() { - parent::setup(); + parent::setUp(); try { $this->_schemaTool->createSchema(array( diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2825Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2825Test.php index 0ba50564f..87c94cb84 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2825Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2825Test.php @@ -16,9 +16,9 @@ class DDC2825Test extends \Doctrine\Tests\OrmFunctionalTestCase /** * {@inheritDoc} */ - protected function setup() + protected function setUp() { - parent::setup(); + parent::setUp(); $platform = $this->_em->getConnection()->getDatabasePlatform(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php index 30724b2c7..09d7415d2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php @@ -2,9 +2,6 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\ORM\Event\LifecycleEventArgs; - /** * @group DDC-2996 */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php index af1fcdc87..402c4374a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php @@ -1,7 +1,10 @@ _schemaTool->createSchema( array( diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC331Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC331Test.php index 88da3268f..92df8d22f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC331Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC331Test.php @@ -2,15 +2,6 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use Doctrine\Tests\Models\Company\CompanyPerson, - Doctrine\Tests\Models\Company\CompanyEmployee, - Doctrine\Tests\Models\Company\CompanyManager, - Doctrine\Tests\Models\Company\CompanyOrganization, - Doctrine\Tests\Models\Company\CompanyEvent, - Doctrine\Tests\Models\Company\CompanyAuction, - Doctrine\Tests\Models\Company\CompanyRaffle, - Doctrine\Tests\Models\Company\CompanyCar; - /** * Functional tests for the Class Table Inheritance mapping strategy. * diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3699Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3699Test.php index a2eff6b57..b33f9a448 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3699Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3699Test.php @@ -1,7 +1,5 @@ _assignedGen->generate($this->_em, $entity); $this->fail('Assigned generator did not throw exception even though ID was missing.'); - } catch (\Doctrine\ORM\ORMException $expected) {} + } catch (ORMException $expected) {} try { $entity = new AssignedCompositeIdEntity; $this->_assignedGen->generate($this->_em, $entity); $this->fail('Assigned generator did not throw exception even though ID was missing.'); - } catch (\Doctrine\ORM\ORMException $expected) {} + } catch (ORMException $expected) {} } public function testCorrectIdGeneration() diff --git a/tests/Doctrine/Tests/ORM/Id/SequenceGeneratorTest.php b/tests/Doctrine/Tests/ORM/Id/SequenceGeneratorTest.php index 413384971..5d7f7a59b 100644 --- a/tests/Doctrine/Tests/ORM/Id/SequenceGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Id/SequenceGeneratorTest.php @@ -3,13 +3,14 @@ namespace Doctrine\Tests\ORM\Id; use Doctrine\ORM\Id\SequenceGenerator; +use Doctrine\Tests\OrmTestCase; /** * Description of SequenceGeneratorTest * * @author robo */ -class SequenceGeneratorTest extends \Doctrine\Tests\OrmTestCase +class SequenceGeneratorTest extends OrmTestCase { private $_em; private $_seqGen; diff --git a/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php b/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php index 92da34cda..03f8bf154 100644 --- a/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php @@ -4,16 +4,14 @@ namespace Doctrine\Tests\ORM; use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\LazyCriteriaCollection; -use Doctrine\Tests\Mocks\ConnectionMock; use stdClass; -use PHPUnit_Framework_TestCase; /** * @author Marco Pivetta * * @covers \Doctrine\ORM\LazyCriteriaCollection */ -class LazyCriteriaCollectionTest extends PHPUnit_Framework_TestCase +class LazyCriteriaCollectionTest extends \PHPUnit_Framework_TestCase { /** * @var \Doctrine\ORM\Persisters\Entity\EntityPersister|\PHPUnit_Framework_MockObject_MockObject diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index 7410979e0..f3f0506b1 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -2,19 +2,21 @@ namespace Doctrine\Tests\ORM\Mapping; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; +use Doctrine\ORM\EntityManager; use Doctrine\ORM\Events; -use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\Mapping\ClassMetadataFactory; use Doctrine\ORM\Mapping\DiscriminatorColumn; use Doctrine\ORM\Mapping\Id; -use Doctrine\Tests\Models\Company\CompanyFixContract; -use Doctrine\Tests\Models\Company\CompanyFlexContract; +use Doctrine\ORM\Mapping\UnderscoreNamingStrategy; use Doctrine\Tests\Models\Cache\City; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\Tests\Models\DDC2825\ExplicitSchemaAndTable; use Doctrine\Tests\Models\DDC2825\SchemaAndTableInTableName; +use Doctrine\Tests\OrmTestCase; -abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase +abstract class AbstractMappingDriverTest extends OrmTestCase { abstract protected function _loadDriver(); @@ -23,7 +25,7 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase $mappingDriver = $this->_loadDriver(); $class = new ClassMetadata($entityClassName); - $class->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $class->initializeReflection(new RuntimeReflectionService()); $mappingDriver->loadMetadataForClass($entityClassName, $class); return $class; @@ -33,11 +35,11 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase * @param \Doctrine\ORM\EntityManager $entityClassName * @return \Doctrine\ORM\Mapping\ClassMetadataFactory */ - protected function createClassMetadataFactory(\Doctrine\ORM\EntityManager $em = null) + protected function createClassMetadataFactory(EntityManager $em = null) { $driver = $this->_loadDriver(); $em = $em ?: $this->_getTestEntityManager(); - $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); + $factory = new ClassMetadataFactory(); $em->getConfiguration()->setMetadataDriverImpl($driver); $factory->setEntityManager($em); @@ -488,7 +490,7 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase $this->assertInstanceOf('Doctrine\ORM\Mapping\DefaultNamingStrategy', $em->getConfiguration()->getNamingStrategy()); - $em->getConfiguration()->setNamingStrategy(new \Doctrine\ORM\Mapping\UnderscoreNamingStrategy(CASE_UPPER)); + $em->getConfiguration()->setNamingStrategy(new UnderscoreNamingStrategy(CASE_UPPER)); $this->assertInstanceOf('Doctrine\ORM\Mapping\UnderscoreNamingStrategy', $em->getConfiguration()->getNamingStrategy()); $class = $factory->getMetadataFor('Doctrine\Tests\Models\DDC1476\DDC1476EntityWithDefaultFieldType'); diff --git a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php index e1838dfe8..4b44d1d41 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php @@ -2,10 +2,11 @@ namespace Doctrine\Tests\ORM\Mapping; +use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\ORM\Events; -use Doctrine\Tests\Models\DDC2825\ExplicitSchemaAndTable; -use Doctrine\Tests\Models\DDC2825\SchemaAndTableInTableName; +use Doctrine\ORM\Mapping\ClassMetadataFactory; +use Doctrine\ORM\Mapping\Driver\AnnotationDriver; class AnnotationDriverTest extends AbstractMappingDriverTest { @@ -15,9 +16,9 @@ class AnnotationDriverTest extends AbstractMappingDriverTest public function testLoadMetadataForNonEntityThrowsException() { $cm = new ClassMetadata('stdClass'); - $cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); - $reader = new \Doctrine\Common\Annotations\AnnotationReader(); - $annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader); + $cm->initializeReflection(new RuntimeReflectionService()); + $reader = new AnnotationReader(); + $annotationDriver = new AnnotationDriver($reader); $this->setExpectedException('Doctrine\ORM\Mapping\MappingException'); $annotationDriver->loadMetadataForClass('stdClass', $cm); @@ -42,7 +43,7 @@ class AnnotationDriverTest extends AbstractMappingDriverTest public function testColumnWithMissingTypeDefaultsToString() { $cm = new ClassMetadata('Doctrine\Tests\ORM\Mapping\ColumnWithoutType'); - $cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $cm->initializeReflection(new RuntimeReflectionService()); $annotationDriver = $this->_loadDriver(); $annotationDriver->loadMetadataForClass('Doctrine\Tests\ORM\Mapping\InvalidColumn', $cm); @@ -134,7 +135,7 @@ class AnnotationDriverTest extends AbstractMappingDriverTest $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); - $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); + $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); $classPage = $factory->getMetadataFor('Doctrine\Tests\Models\DirectoryTree\File'); @@ -153,7 +154,7 @@ class AnnotationDriverTest extends AbstractMappingDriverTest $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); - $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); + $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); $this->setExpectedException('Doctrine\ORM\Mapping\MappingException', @@ -171,7 +172,7 @@ class AnnotationDriverTest extends AbstractMappingDriverTest $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); - $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); + $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); $this->setExpectedException('Doctrine\ORM\Mapping\MappingException', @@ -187,10 +188,9 @@ class AnnotationDriverTest extends AbstractMappingDriverTest { $annotationDriver = $this->_loadDriver(); - $cm = new ClassMetadata('Doctrine\Tests\ORM\Mapping\AnnotationChild'); $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); - $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); + $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); $cm = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\AnnotationChild'); @@ -209,7 +209,7 @@ class AnnotationDriverTest extends AbstractMappingDriverTest $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); - $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); + $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); $cm = $factory->getMetadataFor('Doctrine\Tests\ORM\Mapping\ChildEntity'); @@ -221,7 +221,7 @@ class AnnotationDriverTest extends AbstractMappingDriverTest $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); - $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); + $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); $this->setExpectedException('Doctrine\Common\Annotations\AnnotationException', diff --git a/tests/Doctrine/Tests/ORM/Mapping/AnsiQuoteStrategyTest.php b/tests/Doctrine/Tests/ORM/Mapping/AnsiQuoteStrategyTest.php index 8cec99717..d5f2a9738 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AnsiQuoteStrategyTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AnsiQuoteStrategyTest.php @@ -2,6 +2,7 @@ namespace Doctrine\Tests\ORM\Mapping; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\ORM\Mapping\AnsiQuoteStrategy; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Tests\OrmTestCase; @@ -39,7 +40,7 @@ class AnsiQuoteStrategyTest extends OrmTestCase private function createClassMetadata($className) { $class = new ClassMetadata($className); - $class->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $class->initializeReflection(new RuntimeReflectionService()); return $class; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index 5a5f64277..977c1fa26 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -6,8 +6,9 @@ use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\ORM\Mapping\ClassMetadataFactory; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\Tests\Models\DDC869\DDC869Payment; +use Doctrine\Tests\OrmTestCase; -class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase +class BasicInheritanceMappingTest extends OrmTestCase { /** * @var ClassMetadataFactory diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataBuilderTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataBuilderTest.php index d8824e767..58ee64a42 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataBuilderTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataBuilderTest.php @@ -19,13 +19,15 @@ namespace Doctrine\Tests\ORM\Mapping; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; +use Doctrine\Tests\OrmTestCase; /** * @group DDC-659 */ -class ClassMetadataBuilderTest extends \Doctrine\Tests\OrmTestCase +class ClassMetadataBuilderTest extends OrmTestCase { /** * @var ClassMetadata @@ -39,7 +41,7 @@ class ClassMetadataBuilderTest extends \Doctrine\Tests\OrmTestCase public function setUp() { $this->cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'); - $this->cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $this->cm->initializeReflection(new RuntimeReflectionService()); $this->builder = new ClassMetadataBuilder($this->cm); } diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php index 4cabaec88..71dc598a8 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php @@ -3,6 +3,8 @@ namespace Doctrine\Tests\ORM\Mapping; use Doctrine\Common\EventManager; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; +use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs; use Doctrine\ORM\Events; @@ -13,8 +15,9 @@ use Doctrine\Tests\Mocks\ConnectionMock; use Doctrine\Tests\Mocks\DriverMock; use Doctrine\Tests\Mocks\EntityManagerMock; use Doctrine\Tests\Mocks\MetadataDriverMock; +use Doctrine\Tests\OrmTestCase; -class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase +class ClassMetadataFactoryTest extends OrmTestCase { public function testGetMetadataForSingleClass() { @@ -219,7 +222,7 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase protected function _createEntityManager($metadataDriver, $conn = null) { $driverMock = new DriverMock(); - $config = new \Doctrine\ORM\Configuration(); + $config = new Configuration(); $config->setProxyDir(__DIR__ . '/../../Proxies'); $config->setProxyNamespace('Doctrine\Tests\Proxies'); $eventManager = new EventManager(); @@ -251,7 +254,7 @@ class ClassMetadataFactoryTest extends \Doctrine\Tests\OrmTestCase { // Self-made metadata $cm1 = new ClassMetadata('Doctrine\Tests\ORM\Mapping\TestEntity1'); - $cm1->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $cm1->initializeReflection(new RuntimeReflectionService()); $cm1->setPrimaryTable(array('name' => '`group`')); // Add a mapped field $cm1->mapField(array('fieldName' => 'name', 'type' => 'string')); diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php index 2d949aeef..04cea3894 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php @@ -2,10 +2,11 @@ namespace Doctrine\Tests\ORM\Mapping; -use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\Event\LoadClassMetadataEventArgs; use Doctrine\ORM\Events; +use Doctrine\Tests\OrmTestCase; -class ClassMetadataLoadEventTest extends \Doctrine\Tests\OrmTestCase +class ClassMetadataLoadEventTest extends OrmTestCase { /** * @group DDC-1610 @@ -22,7 +23,7 @@ class ClassMetadataLoadEventTest extends \Doctrine\Tests\OrmTestCase $this->assertInstanceOf('ReflectionProperty', $classMetadata->reflFields['about']); } - public function loadClassMetadata(\Doctrine\ORM\Event\LoadClassMetadataEventArgs $eventArgs) + public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) { $classMetadata = $eventArgs->getClassMetadata(); $field = array( diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 2a7b65002..e324c3729 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -7,10 +7,13 @@ use Doctrine\Common\Persistence\Mapping\StaticReflectionService; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Events; use Doctrine\ORM\Mapping\DefaultNamingStrategy; +use Doctrine\ORM\Mapping\UnderscoreNamingStrategy; +use Doctrine\Tests\OrmTestCase; +use Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser; require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php'; -class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase +class ClassMetadataTest extends OrmTestCase { public function testClassMetadataInstanceSerialization() { @@ -329,7 +332,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase */ public function testUnderscoreNamingStrategyDefaults() { - $namingStrategy = new \Doctrine\ORM\Mapping\UnderscoreNamingStrategy(CASE_UPPER); + $namingStrategy = new UnderscoreNamingStrategy(CASE_UPPER); $oneToOneMetadata = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', $namingStrategy); $manyToManyMetadata = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', $namingStrategy); @@ -724,8 +727,8 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase $metadata = new ClassMetadata('Doctrine\Tests\Models\Company\CompanyContract'); $metadata->initializeReflection(new RuntimeReflectionService()); - $metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyContractListener', 'prePersistHandler'); - $metadata->addEntityListener(\Doctrine\ORM\Events::postPersist, 'CompanyContractListener', 'postPersistHandler'); + $metadata->addEntityListener(Events::prePersist, 'CompanyContractListener', 'prePersistHandler'); + $metadata->addEntityListener(Events::postPersist, 'CompanyContractListener', 'postPersistHandler'); $serialize = serialize($metadata); $unserialize = unserialize($serialize); @@ -814,7 +817,7 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase */ public function testClassCaseSensitivity() { - $user = new \Doctrine\Tests\Models\CMS\CmsUser(); + $user = new CmsUser(); $cm = new ClassMetadata('DOCTRINE\TESTS\MODELS\CMS\CMSUSER'); $cm->initializeReflection(new RuntimeReflectionService()); diff --git a/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php b/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php index 64007b031..bef03b9ba 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php @@ -3,11 +3,12 @@ namespace Doctrine\Tests\ORM\Mapping; use Doctrine\ORM\Mapping\DefaultEntityListenerResolver; +use Doctrine\Tests\OrmTestCase; /** * @group DDC-1955 */ -class EntityListenerResolverTest extends \Doctrine\Tests\OrmTestCase +class EntityListenerResolverTest extends OrmTestCase { /** diff --git a/tests/Doctrine/Tests/ORM/Mapping/FieldBuilderTest.php b/tests/Doctrine/Tests/ORM/Mapping/FieldBuilderTest.php index f882dacc4..3d759aade 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/FieldBuilderTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/FieldBuilderTest.php @@ -21,8 +21,9 @@ namespace Doctrine\Tests\ORM\Mapping; use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder; use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\Tests\OrmTestCase; -class FieldBuilderTest extends \Doctrine\Tests\OrmTestCase +class FieldBuilderTest extends OrmTestCase { public function testCustomIdGeneratorCanBeSet() { diff --git a/tests/Doctrine/Tests/ORM/Mapping/NamingStrategyTest.php b/tests/Doctrine/Tests/ORM/Mapping/NamingStrategyTest.php index 16f0fe576..6274a1468 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/NamingStrategyTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/NamingStrategyTest.php @@ -6,11 +6,12 @@ use Doctrine\ORM\Mapping\UnderscoreNamingStrategy; use Doctrine\ORM\Mapping\DefaultNamingStrategy; use Doctrine\ORM\Mapping\NamingStrategy; use Doctrine\Tests\ORM\Mapping\NamingStrategy\JoinColumnClassNamingStrategy; +use Doctrine\Tests\OrmTestCase; /** * @group DDC-559 */ -class NamingStrategyTest extends \Doctrine\Tests\OrmTestCase +class NamingStrategyTest extends OrmTestCase { /** * @return DefaultNamingStrategy diff --git a/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php index 142455542..cfc7f0cc8 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php @@ -3,8 +3,7 @@ namespace Doctrine\Tests\ORM\Mapping; use Doctrine\ORM\Mapping\ClassMetadata, - Doctrine\Common\Persistence\Mapping\Driver\PHPDriver, - Doctrine\ORM\Tools\Export\ClassMetadataExporter; + Doctrine\Common\Persistence\Mapping\Driver\PHPDriver; class PHPMappingDriverTest extends AbstractMappingDriverTest { diff --git a/tests/Doctrine/Tests/ORM/Mapping/QuoteStrategyTest.php b/tests/Doctrine/Tests/ORM/Mapping/QuoteStrategyTest.php index 0cb60fde4..0b736dd0b 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/QuoteStrategyTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/QuoteStrategyTest.php @@ -2,14 +2,15 @@ namespace Doctrine\Tests\ORM\Mapping; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\ORM\Mapping\DefaultQuoteStrategy; -use Doctrine\ORM\Mapping\QuoteStrategy; use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\Tests\OrmTestCase; /** * @group DDC-1845 */ -class QuoteStrategyTest extends \Doctrine\Tests\OrmTestCase +class QuoteStrategyTest extends OrmTestCase { /** @@ -37,7 +38,7 @@ class QuoteStrategyTest extends \Doctrine\Tests\OrmTestCase private function createClassMetadata($className) { $cm = new ClassMetadata($className); - $cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $cm->initializeReflection(new RuntimeReflectionService()); return $cm; } @@ -73,7 +74,7 @@ class QuoteStrategyTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals('"cms_user"' ,$this->strategy->getTableName($cm, $this->platform)); $cm = new ClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'); - $cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $cm->initializeReflection(new RuntimeReflectionService()); $cm->setPrimaryTable(array('name'=>'cms_user')); $this->assertEquals('cms_user' ,$this->strategy->getTableName($cm, $this->platform)); } @@ -189,7 +190,7 @@ class QuoteStrategyTest extends \Doctrine\Tests\OrmTestCase } } -class MyQuoteStrategy extends \Doctrine\ORM\Mapping\DefaultQuoteStrategy +class MyQuoteStrategy extends DefaultQuoteStrategy { } diff --git a/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php index 99e436ae8..2056c1da0 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php @@ -96,18 +96,4 @@ abstract class AbstractDriverTest extends \PHPUnit_Framework_TestCase abstract protected function getFileExtension(); abstract protected function getDriver(array $paths = array()); - - private function setField($obj, $field, $value) - { - $ref = new \ReflectionProperty($obj, $field); - $ref->setAccessible(true); - $ref->setValue($obj, $value); - } - - private function invoke($obj, $method, array $args = array()) { - $ref = new \ReflectionMethod($obj, $method); - $ref->setAccessible(true); - - return $ref->invokeArgs($obj, $args); - } } diff --git a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php index c2822f178..735c16ed5 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php @@ -2,6 +2,7 @@ namespace Doctrine\Tests\ORM\Mapping; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadataFactory; use Doctrine\ORM\Mapping\Driver\XmlDriver; @@ -19,7 +20,7 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest $mappingDriver = $this->_loadDriver(); $class = new ClassMetadata($className); - $class->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $class->initializeReflection(new RuntimeReflectionService()); $mappingDriver->loadMetadataForClass($className, $class); $expectedMap = array( diff --git a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php index 95d6c7f9a..c752c6a82 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php @@ -3,8 +3,8 @@ namespace Doctrine\Tests\ORM\Mapping; use Doctrine\ORM\Mapping\ClassMetadata, - Doctrine\ORM\Mapping\Driver\XmlDriver, Doctrine\ORM\Mapping\Driver\YamlDriver; +use Doctrine\ORM\Mapping\ClassMetadataFactory; class YamlMappingDriverTest extends AbstractMappingDriverTest { @@ -29,7 +29,7 @@ class YamlMappingDriverTest extends AbstractMappingDriverTest $em = $this->_getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($yamlDriver); - $factory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); + $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); $classPage = new ClassMetadata('Doctrine\Tests\Models\DirectoryTree\File'); diff --git a/tests/Doctrine/Tests/ORM/Performance/DDC2602Test.php b/tests/Doctrine/Tests/ORM/Performance/DDC2602Test.php index 5b307eba1..210f72c80 100644 --- a/tests/Doctrine/Tests/ORM/Performance/DDC2602Test.php +++ b/tests/Doctrine/Tests/ORM/Performance/DDC2602Test.php @@ -5,12 +5,13 @@ namespace Doctrine\Tests\ORM\Performance; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Events; +use Doctrine\Tests\OrmPerformanceTestCase; /** * @group performance * @group DDC-2602 */ -class DDC2602Test extends \Doctrine\Tests\OrmPerformanceTestCase +class DDC2602Test extends OrmPerformanceTestCase { protected function setUp() { diff --git a/tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php index ab6e3259c..e4d65e1e7 100644 --- a/tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php @@ -2,9 +2,13 @@ namespace Doctrine\Tests\ORM\Performance; +use Doctrine\ORM\Internal\Hydration\ArrayHydrator; +use Doctrine\ORM\Internal\Hydration\ObjectHydrator; +use Doctrine\ORM\Internal\Hydration\ScalarHydrator; use Doctrine\Tests\Mocks\HydratorMockStatement, Doctrine\ORM\Query\ResultSetMapping, Doctrine\ORM\Query; +use Doctrine\Tests\OrmPerformanceTestCase; /** * Tests to prevent serious performance regressions. @@ -15,7 +19,7 @@ use Doctrine\Tests\Mocks\HydratorMockStatement, * @author robo * @group performance */ -class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase +class HydrationPerformanceTest extends OrmPerformanceTestCase { /** * Times for comparison: @@ -66,7 +70,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase } $stmt = new HydratorMockStatement($resultSet); - $hydrator = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this->_em); + $hydrator = new ScalarHydrator($this->_em); $this->setMaxRunningTime(1); $s = microtime(true); @@ -124,7 +128,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase } $stmt = new HydratorMockStatement($resultSet); - $hydrator = new \Doctrine\ORM\Internal\Hydration\ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->_em); $this->setMaxRunningTime(2); $s = microtime(true); @@ -198,7 +202,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase } $stmt = new HydratorMockStatement($resultSet); - $hydrator = new \Doctrine\ORM\Internal\Hydration\ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->_em); $this->setMaxRunningTime(3); $s = microtime(true); @@ -254,7 +258,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase } $stmt = new HydratorMockStatement($resultSet); - $hydrator = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->_em); $this->setMaxRunningTime(3); $s = microtime(true); @@ -310,7 +314,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase } $stmt = new HydratorMockStatement($resultSet); - $hydrator = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->_em); $this->setMaxRunningTime(5); $s = microtime(true); @@ -382,7 +386,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase } $stmt = new HydratorMockStatement($resultSet); - $hydrator = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->_em); $this->setMaxRunningTime(1); $s = microtime(true); @@ -447,7 +451,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase } $stmt = new HydratorMockStatement($resultSet); - $hydrator = new \Doctrine\ORM\Internal\Hydration\ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->_em); $this->setMaxRunningTime(1); $s = microtime(true); diff --git a/tests/Doctrine/Tests/ORM/Performance/InheritancePersisterPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/InheritancePersisterPerformanceTest.php index b18fe2850..2104587ae 100644 --- a/tests/Doctrine/Tests/ORM/Performance/InheritancePersisterPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/InheritancePersisterPerformanceTest.php @@ -2,13 +2,17 @@ namespace Doctrine\Tests\ORM\Performance; -use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Query; +use Doctrine\Tests\Models\Company\CompanyEmployee; +use Doctrine\Tests\Models\Company\CompanyFixContract; +use Doctrine\Tests\Models\Company\CompanyFlexContract; +use Doctrine\Tests\Models\Company\CompanyFlexUltraContract; +use Doctrine\Tests\OrmFunctionalTestCase; /** * @group performance */ -class InheritancePersisterPerformanceTest extends \Doctrine\Tests\OrmFunctionalTestCase +class InheritancePersisterPerformanceTest extends OrmFunctionalTestCase { protected function setUp() { @@ -18,27 +22,27 @@ class InheritancePersisterPerformanceTest extends \Doctrine\Tests\OrmFunctionalT public function testCompanyContract() { - $person = new \Doctrine\Tests\Models\Company\CompanyEmployee(); + $person = new CompanyEmployee(); $person->setName('Poor Sales Guy'); $person->setDepartment('Sales'); $person->setSalary(100); $this->_em->persist($person); for ($i = 0; $i < 33; $i++) { - $fix = new \Doctrine\Tests\Models\Company\CompanyFixContract(); + $fix = new CompanyFixContract(); $fix->setFixPrice(1000); $fix->setSalesPerson($person); $fix->markCompleted(); $this->_em->persist($fix); - $flex = new \Doctrine\Tests\Models\Company\CompanyFlexContract(); + $flex = new CompanyFlexContract(); $flex->setSalesPerson($person); $flex->setHoursWorked(100); $flex->setPricePerHour(100); $flex->markCompleted(); $this->_em->persist($flex); - $ultra = new \Doctrine\Tests\Models\Company\CompanyFlexUltraContract(); + $ultra = new CompanyFlexUltraContract(); $ultra->setSalesPerson($person); $ultra->setHoursWorked(150); $ultra->setPricePerHour(150); diff --git a/tests/Doctrine/Tests/ORM/Performance/InsertPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/InsertPerformanceTest.php index f387d1d23..db5455b06 100644 --- a/tests/Doctrine/Tests/ORM/Performance/InsertPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/InsertPerformanceTest.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\ORM\Performance; use Doctrine\Tests\Models\CMS\CmsUser; +use Doctrine\Tests\OrmPerformanceTestCase; /** * Description of InsertPerformanceTest @@ -10,9 +11,10 @@ use Doctrine\Tests\Models\CMS\CmsUser; * @author robo * @group performance */ -class InsertPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase +class InsertPerformanceTest extends OrmPerformanceTestCase { - protected function setUp() { + protected function setUp() + { $this->useModelSet('cms'); parent::setUp(); } diff --git a/tests/Doctrine/Tests/ORM/Performance/PersisterPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/PersisterPerformanceTest.php index 21be1abad..db5d0f8ef 100644 --- a/tests/Doctrine/Tests/ORM/Performance/PersisterPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/PersisterPerformanceTest.php @@ -2,19 +2,16 @@ namespace Doctrine\Tests\ORM\Performance; -use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Query; use Doctrine\Tests\Models\CMS\CmsUser; -use Doctrine\Tests\Models\CMS\CmsPhonenumber; -use Doctrine\Tests\Models\CMS\CmsAddress; use Doctrine\Tests\Models\CMS\CmsGroup; use Doctrine\Tests\Models\CMS\CmsArticle; -use Doctrine\Tests\Models\CMS\CmsComment; +use Doctrine\Tests\OrmFunctionalTestCase; /** * @group performance */ -class PersisterPerformanceTest extends \Doctrine\Tests\OrmFunctionalTestCase +class PersisterPerformanceTest extends OrmFunctionalTestCase { protected function setUp() { diff --git a/tests/Doctrine/Tests/ORM/Performance/ProxyPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/ProxyPerformanceTest.php index a43907f9e..ffe621eef 100644 --- a/tests/Doctrine/Tests/ORM/Performance/ProxyPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/ProxyPerformanceTest.php @@ -20,7 +20,6 @@ namespace Doctrine\Tests\ORM\Performance; use Doctrine\Tests\OrmPerformanceTestCase; -use Doctrine\Common\Proxy\Proxy; use Doctrine\ORM\EntityManager; use Doctrine\ORM\UnitOfWork; use Doctrine\ORM\Proxy\ProxyFactory; diff --git a/tests/Doctrine/Tests/ORM/Performance/UnitOfWorkPerformanceTest.php b/tests/Doctrine/Tests/ORM/Performance/UnitOfWorkPerformanceTest.php index f2aeda714..934933635 100644 --- a/tests/Doctrine/Tests/ORM/Performance/UnitOfWorkPerformanceTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/UnitOfWorkPerformanceTest.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\ORM\Performance; use Doctrine\Tests\Models\CMS\CmsUser; +use Doctrine\Tests\OrmPerformanceTestCase; /** * Description of InsertPerformanceTest @@ -10,7 +11,7 @@ use Doctrine\Tests\Models\CMS\CmsUser; * @author robo * @group performance */ -class UnitOfWorkPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase +class UnitOfWorkPerformanceTest extends OrmPerformanceTestCase { protected function setUp() { diff --git a/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php b/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php index 5b1ffce62..4956e5648 100644 --- a/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/PersistentCollectionTest.php @@ -3,7 +3,6 @@ namespace Doctrine\Tests\ORM; use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Collections\Collection; use Doctrine\ORM\PersistentCollection; use Doctrine\Tests\Mocks\ConnectionMock; use Doctrine\Tests\Mocks\DriverMock; diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php index 76daadc3f..74d72856e 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php @@ -6,8 +6,9 @@ use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\Persisters\Entity\BasicEntityPersister; use Doctrine\Tests\Models\GeoNames\Admin1; use Doctrine\Tests\Models\GeoNames\Country; +use Doctrine\Tests\OrmTestCase; -class BasicEntityPersisterCompositeTypeParametersTest extends \Doctrine\Tests\OrmTestCase +class BasicEntityPersisterCompositeTypeParametersTest extends OrmTestCase { /** * @var BasicEntityPersister diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php index 54b1a2351..e788826d4 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php @@ -2,15 +2,11 @@ namespace Doctrine\Tests\ORM\Persisters; -use Doctrine\Common\Collections\Criteria; -use Doctrine\DBAL\Types\Type as DBALType; -use Doctrine\ORM\EntityManager; use Doctrine\ORM\Persisters\Entity\BasicEntityPersister; -use Doctrine\Tests\Models\CustomType\CustomTypeParent; -use Doctrine\Tests\Models\CustomType\CustomTypeChild; use Doctrine\Common\Collections\Expr\Comparison; +use Doctrine\Tests\OrmTestCase; -class BasicEntityPersisterCompositeTypeSqlTest extends \Doctrine\Tests\OrmTestCase +class BasicEntityPersisterCompositeTypeSqlTest extends OrmTestCase { /** * @var BasicEntityPersister diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php index d51e40555..b617d14da 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php @@ -9,8 +9,9 @@ use Doctrine\Tests\Models\CustomType\CustomTypeParent; use Doctrine\Tests\Models\CustomType\CustomTypeChild; use Doctrine\Tests\Models\CustomType\CustomTypeFriend; use Doctrine\Common\Collections\Expr\Comparison; +use Doctrine\Tests\OrmTestCase; -class BasicEntityPersisterTypeValueSqlTest extends \Doctrine\Tests\OrmTestCase +class BasicEntityPersisterTypeValueSqlTest extends OrmTestCase { /** * @var BasicEntityPersister diff --git a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php index a8a2adaba..39fab08b9 100644 --- a/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php @@ -2,21 +2,22 @@ namespace Doctrine\Tests\ORM\Proxy; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\ORM\EntityNotFoundException; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Proxy\ProxyFactory; -use Doctrine\Common\Proxy\ProxyGenerator; use Doctrine\Tests\Mocks\ConnectionMock; use Doctrine\Tests\Mocks\EntityManagerMock; use Doctrine\Tests\Mocks\UnitOfWorkMock; use Doctrine\Tests\Mocks\DriverMock; use Doctrine\Common\Proxy\AbstractProxyFactory; +use Doctrine\Tests\OrmTestCase; /** * Test the proxy generator. Its work is generating on-the-fly subclasses of a given model, which implement the Proxy pattern. * @author Giorgio Sironi */ -class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase +class ProxyFactoryTest extends OrmTestCase { /** * @var ConnectionMock @@ -75,7 +76,7 @@ class ProxyFactoryTest extends \Doctrine\Tests\OrmTestCase public function testSkipAbstractClassesOnGeneration() { $cm = new ClassMetadata(__NAMESPACE__ . '\\AbstractClass'); - $cm->initializeReflection(new \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService); + $cm->initializeReflection(new RuntimeReflectionService()); $this->assertNotNull($cm->reflClass); $num = $this->proxyFactory->generateProxyClasses(array($cm)); diff --git a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php index 60545d4f9..284cc1adc 100644 --- a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php +++ b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php @@ -20,6 +20,7 @@ namespace Doctrine\Tests\ORM\Query; use Doctrine\ORM\Query; +use Doctrine\Tests\OrmTestCase; /** * Test case for custom AST walking and adding new joins. @@ -28,7 +29,7 @@ use Doctrine\ORM\Query; * @license MIT * @link http://www.doctrine-project.org */ -class CustomTreeWalkersJoinTest extends \Doctrine\Tests\OrmTestCase +class CustomTreeWalkersJoinTest extends OrmTestCase { private $em; diff --git a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php index 574b37ae7..dffcd481a 100644 --- a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php +++ b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php @@ -20,6 +20,7 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\ORM\Query; +use Doctrine\Tests\OrmTestCase; /** * Test case for custom AST walking and modification. @@ -29,7 +30,7 @@ use Doctrine\ORM\Query; * @link http://www.doctrine-project.org * @since 2.0 */ -class CustomTreeWalkersTest extends \Doctrine\Tests\OrmTestCase +class CustomTreeWalkersTest extends OrmTestCase { private $_em; diff --git a/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php index 21679c894..0bae052d8 100644 --- a/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php @@ -20,6 +20,7 @@ */ namespace Doctrine\Tests\ORM\Query; +use Doctrine\Tests\OrmTestCase; /** * Test case for testing the saving and referencing of query identifiers. @@ -35,7 +36,7 @@ namespace Doctrine\Tests\ORM\Query; * testcases later since we'll have a lot of them and we might want to have special SQL * generation tests for some dbms specific SQL syntaxes. */ -class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase +class DeleteSqlGenerationTest extends OrmTestCase { private $_em; diff --git a/tests/Doctrine/Tests/ORM/Query/ExprTest.php b/tests/Doctrine/Tests/ORM/Query/ExprTest.php index d64fed335..4974f2d7a 100644 --- a/tests/Doctrine/Tests/ORM/Query/ExprTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ExprTest.php @@ -21,6 +21,7 @@ namespace Doctrine\Tests\ORM\Query; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\Query; +use Doctrine\Tests\OrmTestCase; /** * Test case for the DQL Expr class used for generating DQL snippets through @@ -32,7 +33,7 @@ use Doctrine\ORM\Query; * @since 2.0 * @version $Revision$ */ -class ExprTest extends \Doctrine\Tests\OrmTestCase +class ExprTest extends OrmTestCase { private $_em; diff --git a/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php b/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php index 455949de0..7a50516a7 100644 --- a/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php @@ -2,15 +2,16 @@ namespace Doctrine\Tests\ORM\Query; -use Doctrine\ORM\Mapping\ClassMetaData, +use Doctrine\ORM\Mapping\ClassMetadata, Doctrine\ORM\Query\Filter\SQLFilter; +use Doctrine\Tests\OrmTestCase; /** * Test case for FilterCollection * * @author Guilherme Blanco */ -class FilterCollectionTest extends \Doctrine\Tests\OrmTestCase +class FilterCollectionTest extends OrmTestCase { /** * @var \Doctrine\ORM\EntityManager diff --git a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php index b90047e19..daec446bb 100644 --- a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php @@ -1,11 +1,13 @@ setHint($key, $value); } - $parser = new \Doctrine\ORM\Query\Parser($query); + $parser = new Query\Parser($query); // We do NOT test SQL output here. That only unnecessarily slows down the tests! $parser->setCustomOutputTreeWalker('Doctrine\Tests\Mocks\MockTreeWalker'); diff --git a/tests/Doctrine/Tests/ORM/Query/LexerTest.php b/tests/Doctrine/Tests/ORM/Query/LexerTest.php index 5c9828731..9c4a889f0 100644 --- a/tests/Doctrine/Tests/ORM/Query/LexerTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LexerTest.php @@ -3,8 +3,9 @@ namespace Doctrine\Tests\ORM\Query; use Doctrine\ORM\Query\Lexer; +use Doctrine\Tests\OrmTestCase; -class LexerTest extends \Doctrine\Tests\OrmTestCase +class LexerTest extends OrmTestCase { //private $_lexer; diff --git a/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php b/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php index 4e00bbc88..d10c78c9c 100644 --- a/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php @@ -21,9 +21,10 @@ namespace Doctrine\Tests\ORM\Query; use Doctrine\ORM\Query\ParameterTypeInferer; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Types\Type; +use Doctrine\Tests\OrmTestCase; use PDO; -class ParameterTypeInfererTest extends \Doctrine\Tests\OrmTestCase +class ParameterTypeInfererTest extends OrmTestCase { public function providerParameterTypeInferer() diff --git a/tests/Doctrine/Tests/ORM/Query/ParserTest.php b/tests/Doctrine/Tests/ORM/Query/ParserTest.php index 1bc7f5dfb..097f9ec88 100644 --- a/tests/Doctrine/Tests/ORM/Query/ParserTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ParserTest.php @@ -5,8 +5,9 @@ namespace Doctrine\Tests\ORM\Query; use Doctrine\ORM\Query; use Doctrine\ORM\Query\Lexer; use Doctrine\ORM\Query\Parser; +use Doctrine\Tests\OrmTestCase; -class ParserTest extends \Doctrine\Tests\OrmTestCase +class ParserTest extends OrmTestCase { /** diff --git a/tests/Doctrine/Tests/ORM/Query/QueryTest.php b/tests/Doctrine/Tests/ORM/Query/QueryTest.php index 2618af1db..d59c93b07 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryTest.php @@ -9,8 +9,9 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\Query\Parameter; use Doctrine\Tests\Mocks\DriverConnectionMock; use Doctrine\Tests\Mocks\StatementArrayMock; +use Doctrine\Tests\OrmTestCase; -class QueryTest extends \Doctrine\Tests\OrmTestCase +class QueryTest extends OrmTestCase { /** @var EntityManager */ protected $_em = null; diff --git a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php index 1aabaa78b..fa12a3e33 100644 --- a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php @@ -2,10 +2,24 @@ namespace Doctrine\Tests\ORM\Query; +use Doctrine\DBAL\LockMode; +use Doctrine\DBAL\Platforms\MySqlPlatform; +use Doctrine\DBAL\Platforms\OraclePlatform; +use Doctrine\DBAL\Platforms\PostgreSqlPlatform; +use Doctrine\DBAL\Platforms\SqlitePlatform; +use Doctrine\DBAL\Platforms\SQLServerPlatform; use Doctrine\DBAL\Types\Type as DBALType; -use Doctrine\ORM\Query; +use Doctrine\ORM\Query as ORMQuery; +use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\Lexer; +use Doctrine\ORM\Query\Parser; +use Doctrine\ORM\Query\SqlWalker; +use Doctrine\Tests\Models\CMS\CmsGroup; +use Doctrine\Tests\Models\CMS\CmsPhonenumber; +use Doctrine\Tests\Models\Company\CompanyPerson; +use Doctrine\Tests\OrmTestCase; -class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase +class SelectSqlGenerationTest extends OrmTestCase { private $_em; @@ -31,7 +45,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $query->setParameter($name, $value); } - $query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true) + $query->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true) ->useQueryCache(false); foreach ($queryHints AS $name => $value) { @@ -70,7 +84,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $query->setParameter($name, $value); } - $query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true) + $query->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true) ->useQueryCache(false); foreach ($queryHints AS $name => $value) { @@ -92,7 +106,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT c.id FROM Doctrine\Tests\Models\Company\CompanyPerson c JOIN Doctrine\Tests\Models\Company\CompanyPerson r WHERE c.spouse = r AND r.id = 42', 'SELECT c0_.id AS id_0 FROM company_persons c0_ INNER JOIN company_persons c1_ WHERE c0_.spouse_id = c1_.id AND c1_.id = 42', - array(Query::HINT_FORCE_PARTIAL_LOAD => true) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => true) ); } @@ -109,7 +123,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT c.id FROM Doctrine\Tests\Models\Company\CompanyPerson c JOIN Doctrine\Tests\Models\Company\CompanyPerson r WHERE c.spouse = r AND r.id = 42', 'SELECT c0_.id AS id_0 FROM company_persons c0_ LEFT JOIN company_managers c1_ ON c0_.id = c1_.id LEFT JOIN company_employees c2_ ON c0_.id = c2_.id INNER JOIN company_persons c3_ LEFT JOIN company_managers c4_ ON c3_.id = c4_.id LEFT JOIN company_employees c5_ ON c3_.id = c5_.id WHERE c0_.spouse_id = c3_.id AND c3_.id = 42', - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -299,7 +313,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $connMock = $this->_em->getConnection(); $orgPlatform = $connMock->getDatabasePlatform(); - $connMock->setDatabasePlatform(new \Doctrine\DBAL\Platforms\MySqlPlatform); + $connMock->setDatabasePlatform(new MySqlPlatform()); $this->assertSqlGeneration( 'SELECT COUNT(CONCAT(u.id, u.name)) FROM Doctrine\Tests\Models\CMS\CmsUser u GROUP BY u.id', @@ -514,7 +528,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase { $this->assertInvalidSqlGeneration( "SELECT u FROM Doctrine\Tests\Models\Company\CompanyPerson u WHERE u INSTANCE OF \Doctrine\Tests\Models\CMS\CmsUser", - "Doctrine\ORM\Query\QueryException" + "Doctrine\\ORM\\Query\\QueryException" ); } @@ -601,7 +615,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $connMock = $this->_em->getConnection(); $orgPlatform = $connMock->getDatabasePlatform(); - $connMock->setDatabasePlatform(new \Doctrine\DBAL\Platforms\MySqlPlatform); + $connMock->setDatabasePlatform(new MySqlPlatform()); $this->assertSqlGeneration( "SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE CONCAT(u.name, 's') = ?1", "SELECT c0_.id AS id_0 FROM cms_users c0_ WHERE CONCAT(c0_.name, 's') = ?" @@ -611,7 +625,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase "SELECT CONCAT(c0_.id, c0_.name) AS sclr_0 FROM cms_users c0_ WHERE c0_.id = ?" ); - $connMock->setDatabasePlatform(new \Doctrine\DBAL\Platforms\PostgreSqlPlatform); + $connMock->setDatabasePlatform(new PostgreSqlPlatform()); $this->assertSqlGeneration( "SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE CONCAT(u.name, 's') = ?1", "SELECT c0_.id AS id_0 FROM cms_users c0_ WHERE c0_.name || 's' = ?" @@ -647,9 +661,9 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase { // "Get all users who have $phone as a phonenumber." (*cough* doesnt really make sense...) $q = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.phonenumbers'); - $q->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); + $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); - $phone = new \Doctrine\Tests\Models\CMS\CmsPhonenumber; + $phone = new CmsPhonenumber(); $phone->phonenumber = 101; $q->setParameter('param', $phone); @@ -663,9 +677,9 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase { // "Get all users who are members of $group." $q = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.groups'); - $q->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); + $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); - $group = new \Doctrine\Tests\Models\CMS\CmsGroup; + $group = new CmsGroup(); $group->id = 101; $q->setParameter('param', $group); @@ -678,11 +692,11 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase public function testSupportsMemberOfExpressionManyToManyParameterArray() { $q = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.groups'); - $q->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); + $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); - $group = new \Doctrine\Tests\Models\CMS\CmsGroup; + $group = new CmsGroup(); $group->id = 101; - $group2 = new \Doctrine\Tests\Models\CMS\CmsGroup; + $group2 = new CmsGroup(); $group2->id = 105; $q->setParameter('param', array($group, $group2)); @@ -697,7 +711,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase // "Get all persons who have $person as a friend." // Tough one: Many-many self-referencing ("friends") with class table inheritance $q = $this->_em->createQuery('SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p WHERE :param MEMBER OF p.friends'); - $person = new \Doctrine\Tests\Models\Company\CompanyPerson; + $person = new CompanyPerson(); $this->_em->getClassMetadata(get_class($person))->setIdentifierValues($person, array('id' => 101)); $q->setParameter('param', $person); $this->assertEquals( @@ -731,21 +745,21 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase public function testSupportsCurrentDateFunction() { $q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_date()'); - $q->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); + $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $this->assertEquals('SELECT d0_.id AS id_0 FROM date_time_model d0_ WHERE d0_.col_datetime > CURRENT_DATE', $q->getSql()); } public function testSupportsCurrentTimeFunction() { $q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.time > current_time()'); - $q->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); + $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $this->assertEquals('SELECT d0_.id AS id_0 FROM date_time_model d0_ WHERE d0_.col_time > CURRENT_TIME', $q->getSql()); } public function testSupportsCurrentTimestampFunction() { $q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_timestamp()'); - $q->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); + $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $this->assertEquals('SELECT d0_.id AS id_0 FROM date_time_model d0_ WHERE d0_.col_datetime > CURRENT_TIMESTAMP', $q->getSql()); } @@ -884,7 +898,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase public function testBooleanLiteralInWhereOnSqlite() { $oldPlat = $this->_em->getConnection()->getDatabasePlatform(); - $this->_em->getConnection()->setDatabasePlatform(new \Doctrine\DBAL\Platforms\SqlitePlatform); + $this->_em->getConnection()->setDatabasePlatform(new SqlitePlatform()); $this->assertSqlGeneration( "SELECT b FROM Doctrine\Tests\Models\Generic\BooleanModel b WHERE b.booleanField = true", @@ -902,7 +916,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase public function testBooleanLiteralInWhereOnPostgres() { $oldPlat = $this->_em->getConnection()->getDatabasePlatform(); - $this->_em->getConnection()->setDatabasePlatform(new \Doctrine\DBAL\Platforms\PostgreSqlPlatform); + $this->_em->getConnection()->setDatabasePlatform(new PostgreSqlPlatform()); $this->assertSqlGeneration( "SELECT b FROM Doctrine\Tests\Models\Generic\BooleanModel b WHERE b.booleanField = true", @@ -1024,7 +1038,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase */ public function testPessimisticWriteLockQueryHint() { - if ($this->_em->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { + if ($this->_em->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) { $this->markTestSkipped('SqLite does not support Row locking at all.'); } @@ -1032,7 +1046,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'", "SELECT c0_.id AS id_0, c0_.status AS status_1, c0_.username AS username_2, c0_.name AS name_3 ". "FROM cms_users c0_ WHERE c0_.username = 'gblanco' FOR UPDATE", - array(Query::HINT_LOCK_MODE => \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) + array(ORMQuery::HINT_LOCK_MODE => LockMode::PESSIMISTIC_WRITE) ); } @@ -1042,14 +1056,14 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase */ public function testPessimisticReadLockQueryHintPostgreSql() { - $this->_em->getConnection()->setDatabasePlatform(new \Doctrine\DBAL\Platforms\PostgreSqlPlatform); + $this->_em->getConnection()->setDatabasePlatform(new PostgreSqlPlatform()); $this->assertSqlGeneration( "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'", "SELECT c0_.id AS id_0, c0_.status AS status_1, c0_.username AS username_2, c0_.name AS name_3 ". "FROM cms_users c0_ WHERE c0_.username = 'gblanco' FOR SHARE", - array(Query::HINT_LOCK_MODE => \Doctrine\DBAL\LockMode::PESSIMISTIC_READ) - ); + array(ORMQuery::HINT_LOCK_MODE => LockMode::PESSIMISTIC_READ) + ); } /** @@ -1062,8 +1076,8 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'", "SELECT c0_.id AS id_0, c0_.status AS status_1, c0_.username AS username_2, c0_.name AS name_3 ". "FROM cms_users c0_ WHERE c0_.username = 'gblanco'", - array(Query::HINT_LOCK_MODE => \Doctrine\DBAL\LockMode::NONE) - ); + array(ORMQuery::HINT_LOCK_MODE => LockMode::NONE) + ); } /** @@ -1083,13 +1097,13 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase */ public function testPessimisticReadLockQueryHintMySql() { - $this->_em->getConnection()->setDatabasePlatform(new \Doctrine\DBAL\Platforms\MySqlPlatform); + $this->_em->getConnection()->setDatabasePlatform(new MySqlPlatform()); $this->assertSqlGeneration( "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'", "SELECT c0_.id AS id_0, c0_.status AS status_1, c0_.username AS username_2, c0_.name AS name_3 ". "FROM cms_users c0_ WHERE c0_.username = 'gblanco' LOCK IN SHARE MODE", - array(Query::HINT_LOCK_MODE => \Doctrine\DBAL\LockMode::PESSIMISTIC_READ) + array(ORMQuery::HINT_LOCK_MODE => LockMode::PESSIMISTIC_READ) ); } @@ -1099,13 +1113,13 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase */ public function testPessimisticReadLockQueryHintOracle() { - $this->_em->getConnection()->setDatabasePlatform(new \Doctrine\DBAL\Platforms\OraclePlatform); + $this->_em->getConnection()->setDatabasePlatform(new OraclePlatform()); $this->assertSqlGeneration( "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'", "SELECT c0_.id AS ID_0, c0_.status AS STATUS_1, c0_.username AS USERNAME_2, c0_.name AS NAME_3 ". "FROM cms_users c0_ WHERE c0_.username = 'gblanco' FOR UPDATE", - array(Query::HINT_LOCK_MODE => \Doctrine\DBAL\LockMode::PESSIMISTIC_READ) + array(ORMQuery::HINT_LOCK_MODE => LockMode::PESSIMISTIC_READ) ); } @@ -1426,7 +1440,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p', 'SELECT c0_.id AS id_0, c0_.name AS name_1, c1_.title AS title_2, c2_.salary AS salary_3, c2_.department AS department_4, c2_.startDate AS startDate_5, c0_.discr AS discr_6, c0_.spouse_id AS spouse_id_7, c1_.car_id AS car_id_8 FROM company_persons c0_ LEFT JOIN company_managers c1_ ON c0_.id = c1_.id LEFT JOIN company_employees c2_ ON c0_.id = c2_.id', - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -1438,7 +1452,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p', 'SELECT c0_.id AS id_0, c0_.name AS name_1, c0_.discr AS discr_2 FROM company_persons c0_', - array(Query::HINT_FORCE_PARTIAL_LOAD => true) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => true) ); } @@ -1450,7 +1464,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT e FROM Doctrine\Tests\Models\Company\CompanyEmployee e', 'SELECT c0_.id AS id_0, c0_.name AS name_1, c1_.salary AS salary_2, c1_.department AS department_3, c1_.startDate AS startDate_4, c2_.title AS title_5, c0_.discr AS discr_6, c0_.spouse_id AS spouse_id_7, c2_.car_id AS car_id_8 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id LEFT JOIN company_managers c2_ ON c1_.id = c2_.id', - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -1462,7 +1476,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT e FROM Doctrine\Tests\Models\Company\CompanyEmployee e', 'SELECT c0_.id AS id_0, c0_.name AS name_1, c1_.salary AS salary_2, c1_.department AS department_3, c1_.startDate AS startDate_4, c0_.discr AS discr_5 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id', - array(Query::HINT_FORCE_PARTIAL_LOAD => true) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => true) ); } @@ -1474,7 +1488,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT m FROM Doctrine\Tests\Models\Company\CompanyManager m', 'SELECT c0_.id AS id_0, c0_.name AS name_1, c1_.salary AS salary_2, c1_.department AS department_3, c1_.startDate AS startDate_4, c2_.title AS title_5, c0_.discr AS discr_6, c0_.spouse_id AS spouse_id_7, c2_.car_id AS car_id_8 FROM company_managers c2_ INNER JOIN company_employees c1_ ON c2_.id = c1_.id INNER JOIN company_persons c0_ ON c2_.id = c0_.id', - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -1486,7 +1500,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT m FROM Doctrine\Tests\Models\Company\CompanyManager m', 'SELECT c0_.id AS id_0, c0_.name AS name_1, c1_.salary AS salary_2, c1_.department AS department_3, c1_.startDate AS startDate_4, c2_.title AS title_5, c0_.discr AS discr_6 FROM company_managers c2_ INNER JOIN company_employees c1_ ON c2_.id = c1_.id INNER JOIN company_persons c0_ ON c2_.id = c0_.id', - array(Query::HINT_FORCE_PARTIAL_LOAD => true) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => true) ); } @@ -1498,7 +1512,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT c FROM Doctrine\Tests\Models\Company\CompanyContract c', "SELECT c0_.id AS id_0, c0_.completed AS completed_1, c0_.fixPrice AS fixPrice_2, c0_.hoursWorked AS hoursWorked_3, c0_.pricePerHour AS pricePerHour_4, c0_.maxPrice AS maxPrice_5, c0_.discr AS discr_6, c0_.salesPerson_id AS salesPerson_id_7 FROM company_contracts c0_ WHERE c0_.discr IN ('fix', 'flexible', 'flexultra')", - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -1510,7 +1524,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT c FROM Doctrine\Tests\Models\Company\CompanyContract c', "SELECT c0_.id AS id_0, c0_.completed AS completed_1, c0_.fixPrice AS fixPrice_2, c0_.hoursWorked AS hoursWorked_3, c0_.pricePerHour AS pricePerHour_4, c0_.maxPrice AS maxPrice_5, c0_.discr AS discr_6 FROM company_contracts c0_ WHERE c0_.discr IN ('fix', 'flexible', 'flexultra')", - array(Query::HINT_FORCE_PARTIAL_LOAD => true) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => true) ); } @@ -1522,7 +1536,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT fc FROM Doctrine\Tests\Models\Company\CompanyFlexContract fc', "SELECT c0_.id AS id_0, c0_.completed AS completed_1, c0_.hoursWorked AS hoursWorked_2, c0_.pricePerHour AS pricePerHour_3, c0_.maxPrice AS maxPrice_4, c0_.discr AS discr_5, c0_.salesPerson_id AS salesPerson_id_6 FROM company_contracts c0_ WHERE c0_.discr IN ('flexible', 'flexultra')", - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -1534,7 +1548,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT fc FROM Doctrine\Tests\Models\Company\CompanyFlexContract fc', "SELECT c0_.id AS id_0, c0_.completed AS completed_1, c0_.hoursWorked AS hoursWorked_2, c0_.pricePerHour AS pricePerHour_3, c0_.maxPrice AS maxPrice_4, c0_.discr AS discr_5 FROM company_contracts c0_ WHERE c0_.discr IN ('flexible', 'flexultra')", - array(Query::HINT_FORCE_PARTIAL_LOAD => true) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => true) ); } @@ -1546,7 +1560,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT fuc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract fuc', "SELECT c0_.id AS id_0, c0_.completed AS completed_1, c0_.hoursWorked AS hoursWorked_2, c0_.pricePerHour AS pricePerHour_3, c0_.maxPrice AS maxPrice_4, c0_.discr AS discr_5, c0_.salesPerson_id AS salesPerson_id_6 FROM company_contracts c0_ WHERE c0_.discr IN ('flexultra')", - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -1558,7 +1572,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT fuc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract fuc', "SELECT c0_.id AS id_0, c0_.completed AS completed_1, c0_.hoursWorked AS hoursWorked_2, c0_.pricePerHour AS pricePerHour_3, c0_.maxPrice AS maxPrice_4, c0_.discr AS discr_5 FROM company_contracts c0_ WHERE c0_.discr IN ('flexultra')", - array(Query::HINT_FORCE_PARTIAL_LOAD => true) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => true) ); } @@ -1570,7 +1584,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT p, pp FROM Doctrine\Tests\Models\Company\CompanyPerson p JOIN p.spouse pp', "SELECT c0_.id AS id_0, c0_.name AS name_1, c1_.title AS title_2, c2_.salary AS salary_3, c2_.department AS department_4, c2_.startDate AS startDate_5, c3_.id AS id_6, c3_.name AS name_7, c4_.title AS title_8, c5_.salary AS salary_9, c5_.department AS department_10, c5_.startDate AS startDate_11, c0_.discr AS discr_12, c0_.spouse_id AS spouse_id_13, c1_.car_id AS car_id_14, c3_.discr AS discr_15, c3_.spouse_id AS spouse_id_16, c4_.car_id AS car_id_17 FROM company_persons c0_ LEFT JOIN company_managers c1_ ON c0_.id = c1_.id LEFT JOIN company_employees c2_ ON c0_.id = c2_.id INNER JOIN company_persons c3_ ON c0_.spouse_id = c3_.id LEFT JOIN company_managers c4_ ON c3_.id = c4_.id LEFT JOIN company_employees c5_ ON c3_.id = c5_.id", - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -2051,7 +2065,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $connMock = $this->_em->getConnection(); $orgPlatform = $connMock->getDatabasePlatform(); - $connMock->setDatabasePlatform(new \Doctrine\DBAL\Platforms\MySqlPlatform); + $connMock->setDatabasePlatform(new MySqlPlatform()); $this->assertSqlGeneration( "SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE CONCAT(u.name, u.status, 's') = ?1", "SELECT c0_.id AS id_0 FROM cms_users c0_ WHERE CONCAT(c0_.name, c0_.status, 's') = ?" @@ -2061,7 +2075,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase "SELECT CONCAT(c0_.id, c0_.name, c0_.status) AS sclr_0 FROM cms_users c0_ WHERE c0_.id = ?" ); - $connMock->setDatabasePlatform(new \Doctrine\DBAL\Platforms\PostgreSqlPlatform); + $connMock->setDatabasePlatform(new PostgreSqlPlatform()); $this->assertSqlGeneration( "SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE CONCAT(u.name, u.status, 's') = ?1", "SELECT c0_.id AS id_0 FROM cms_users c0_ WHERE c0_.name || c0_.status || 's' = ?" @@ -2071,7 +2085,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase "SELECT c0_.id || c0_.name || c0_.status AS sclr_0 FROM cms_users c0_ WHERE c0_.id = ?" ); - $connMock->setDatabasePlatform(new \Doctrine\DBAL\Platforms\SQLServerPlatform()); + $connMock->setDatabasePlatform(new SQLServerPlatform()); $this->assertSqlGeneration( "SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE CONCAT(u.name, u.status, 's') = ?1", "SELECT c0_.id AS id_0 FROM cms_users c0_ WHERE (c0_.name + c0_.status + 's') = ?" @@ -2145,7 +2159,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase $this->assertSqlGeneration( 'SELECT e.id FROM Doctrine\Tests\Models\Company\CompanyOrganization o JOIN o.events e WITH e.id = ?1', 'SELECT c0_.id AS id_0 FROM company_organizations c1_ INNER JOIN (company_events c0_ LEFT JOIN company_auctions c2_ ON c0_.id = c2_.id LEFT JOIN company_raffles c3_ ON c0_.id = c3_.id) ON c1_.id = c0_.org_id AND (c0_.id = ?)', - array(Query::HINT_FORCE_PARTIAL_LOAD => false) + array(ORMQuery::HINT_FORCE_PARTIAL_LOAD => false) ); } @@ -2294,14 +2308,14 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase } } -class MyAbsFunction extends \Doctrine\ORM\Query\AST\Functions\FunctionNode +class MyAbsFunction extends FunctionNode { public $simpleArithmeticExpression; /** * @override */ - public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) + public function getSql(SqlWalker $sqlWalker) { return 'ABS(' . $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) . ')'; } @@ -2309,16 +2323,16 @@ class MyAbsFunction extends \Doctrine\ORM\Query\AST\Functions\FunctionNode /** * @override */ - public function parse(\Doctrine\ORM\Query\Parser $parser) + public function parse(Parser $parser) { $lexer = $parser->getLexer(); - $parser->match(\Doctrine\ORM\Query\Lexer::T_IDENTIFIER); - $parser->match(\Doctrine\ORM\Query\Lexer::T_OPEN_PARENTHESIS); + $parser->match(Lexer::T_IDENTIFIER); + $parser->match(Lexer::T_OPEN_PARENTHESIS); $this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); - $parser->match(\Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS); + $parser->match(Lexer::T_CLOSE_PARENTHESIS); } } /** diff --git a/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php index de71ba9b7..5dae79b3d 100644 --- a/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php @@ -22,6 +22,7 @@ namespace Doctrine\Tests\ORM\Query; use Doctrine\DBAL\Types\Type as DBALType; +use Doctrine\Tests\OrmTestCase; /** * Test case for testing the saving and referencing of query identifiers. @@ -37,7 +38,7 @@ use Doctrine\DBAL\Types\Type as DBALType; * testcases later since we'll have a lot of them and we might want to have special SQL * generation tests for some dbms specific SQL syntaxes. */ -class UpdateSqlGenerationTest extends \Doctrine\Tests\OrmTestCase +class UpdateSqlGenerationTest extends OrmTestCase { private $_em; diff --git a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php index abe602a53..318eb2a2f 100644 --- a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php @@ -27,6 +27,7 @@ use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\Query\Parameter; use Doctrine\ORM\Query\ParameterTypeInferer; +use Doctrine\Tests\OrmTestCase; /** * Test case for the QueryBuilder class used to build DQL query string in a @@ -36,7 +37,7 @@ use Doctrine\ORM\Query\ParameterTypeInferer; * @author Roman Borschel setProxyDir(__DIR__ . '/../../Proxies'); $config->setProxyNamespace('Doctrine\Tests\Proxies'); $eventManager = new EventManager(); $conn = new ConnectionMock(array(), $driverMock, $config, $eventManager); - $mockDriver = new MetadataDriverMock(); $config->setMetadataDriverImpl($metadataDriver); return EntityManagerMock::create($conn, $config, $eventManager); @@ -74,7 +75,7 @@ class ConvertDoctrine1SchemaTest extends \Doctrine\Tests\OrmTestCase $this->assertTrue(file_exists(__DIR__ . '/convert/User.dcm.yml')); $this->assertTrue(file_exists(__DIR__ . '/convert/Profile.dcm.yml')); - $metadataDriver = new \Doctrine\ORM\Mapping\Driver\YamlDriver(__DIR__ . '/convert'); + $metadataDriver = new YamlDriver(__DIR__ . '/convert'); $em = $this->_createEntityManager($metadataDriver); $cmf = new DisconnectedClassMetadataFactory(); $cmf->setEntityManager($em); diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 9fdf3b88a..7c09cdf86 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\ORM\Tools; use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\ORM\Mapping\ClassMetadataFactory; use Doctrine\ORM\Mapping\ClassMetadataInfo; @@ -264,9 +265,9 @@ class EntityGeneratorTest extends OrmTestCase $comment = new EntityGeneratorComment(); $this->assertInstanceOf($metadata->name, $book->addComment($comment)); $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $book->getComments()); - $this->assertEquals(new \Doctrine\Common\Collections\ArrayCollection(array($comment)), $book->getComments()); + $this->assertEquals(new ArrayCollection(array($comment)), $book->getComments()); $this->assertInternalType('boolean', $book->removeComment($comment)); - $this->assertEquals(new \Doctrine\Common\Collections\ArrayCollection(array()), $book->getComments()); + $this->assertEquals(new ArrayCollection(array()), $book->getComments()); $this->newInstance($isbnMetadata); $isbn = new $isbnMetadata->name(); diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php index 02d6ed5a1..8a4b6ad5f 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php @@ -5,8 +5,9 @@ namespace Doctrine\Tests\ORM\Tools; use Doctrine\ORM\Tools\EntityGenerator; use Doctrine\ORM\Tools\EntityRepositoryGenerator; use Doctrine\ORM\Mapping\ClassMetadataFactory; +use Doctrine\Tests\OrmTestCase; -class EntityRepositoryGeneratorTest extends \Doctrine\Tests\OrmTestCase +class EntityRepositoryGeneratorTest extends OrmTestCase { /** * @var EntityGenerator diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php index 0743a89d6..d712730ff 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php @@ -21,17 +21,19 @@ namespace Doctrine\Tests\ORM\Tools\Export; +use Doctrine\ORM\Configuration; use Doctrine\ORM\Tools\Export\ClassMetadataExporter; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Tools\EntityGenerator; use Doctrine\Tests\Mocks\MetadataDriverMock; -use Doctrine\Tests\Mocks\DatabasePlatformMock; use Doctrine\Tests\Mocks\EntityManagerMock; use Doctrine\Tests\Mocks\ConnectionMock; use Doctrine\Tests\Mocks\DriverMock; use Doctrine\Common\EventManager; use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory; use Doctrine\ORM\Mapping\ClassMetadataFactory; +use Doctrine\Tests\OrmTestCase; +use Symfony\Component\Yaml\Parser; /** * Test case for ClassMetadataExporter @@ -43,7 +45,7 @@ use Doctrine\ORM\Mapping\ClassMetadataFactory; * @since 2.0 * @version $Revision$ */ -abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTestCase +abstract class AbstractClassMetadataExporterTest extends OrmTestCase { protected $_extension; @@ -52,12 +54,11 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest protected function _createEntityManager($metadataDriver) { $driverMock = new DriverMock(); - $config = new \Doctrine\ORM\Configuration(); + $config = new Configuration(); $config->setProxyDir(__DIR__ . '/../../Proxies'); $config->setProxyNamespace('Doctrine\Tests\Proxies'); $eventManager = new EventManager(); $conn = new ConnectionMock(array(), $driverMock, $config, $eventManager); - $mockDriver = new MetadataDriverMock(); $config->setMetadataDriverImpl($metadataDriver); return EntityManagerMock::create($conn, $config, $eventManager); @@ -376,7 +377,7 @@ abstract class AbstractClassMetadataExporterTest extends \Doctrine\Tests\OrmTest $this->assertEquals('cascade-all', $nodes[0]->getName()); } else if ($type == 'yaml') { - $yaml = new \Symfony\Component\Yaml\Parser(); + $yaml = new Parser(); $value = $yaml->parse(file_get_contents(__DIR__ . '/export/'.$type.'/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.yml')); $this->assertTrue(isset($value['Doctrine\Tests\ORM\Tools\Export\ExportedUser']['oneToMany']['interests']['cascade'])); diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/CountOutputWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/CountOutputWalkerTest.php index a9bb02da4..f6c63f752 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/CountOutputWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/CountOutputWalkerTest.php @@ -14,7 +14,7 @@ class CountOutputWalkerTest extends PaginationTestCase $query->setFirstResult(null)->setMaxResults(null); $this->assertEquals( - "SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT id_0 FROM (SELECT b0_.id AS id_0, c1_.id AS id_1, a2_.id AS id_2, a2_.name AS name_3, b0_.author_id AS author_id_4, b0_.category_id AS category_id_5 FROM BlogPost b0_ INNER JOIN Category c1_ ON b0_.category_id = c1_.id INNER JOIN Author a2_ ON b0_.author_id = a2_.id) dctrn_result) dctrn_table", $query->getSql() + "SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT id_0 FROM (SELECT b0_.id AS id_0, c1_.id AS id_1, a2_.id AS id_2, a2_.name AS name_3, b0_.author_id AS author_id_4, b0_.category_id AS category_id_5 FROM BlogPost b0_ INNER JOIN Category c1_ ON b0_.category_id = c1_.id INNER JOIN Author a2_ ON b0_.author_id = a2_.id) dctrn_result) dctrn_table", $query->getSQL() ); } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/CountWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/CountWalkerTest.php index e44248926..b8d1b41a6 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/CountWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/CountWalkerTest.php @@ -19,7 +19,7 @@ class CountWalkerTest extends PaginationTestCase $query->setFirstResult(null)->setMaxResults(null); $this->assertEquals( - "SELECT count(DISTINCT b0_.id) AS sclr_0 FROM BlogPost b0_ INNER JOIN Category c1_ ON b0_.category_id = c1_.id INNER JOIN Author a2_ ON b0_.author_id = a2_.id", $query->getSql() + "SELECT count(DISTINCT b0_.id) AS sclr_0 FROM BlogPost b0_ INNER JOIN Category c1_ ON b0_.category_id = c1_.id INNER JOIN Author a2_ ON b0_.author_id = a2_.id", $query->getSQL() ); } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php index 897e3531e..b30ef51fc 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php @@ -5,7 +5,6 @@ namespace Doctrine\Tests\ORM\Tools\Pagination; use Doctrine\DBAL\Platforms\MySqlPlatform; use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\PostgreSqlPlatform; -use Doctrine\DBAL\Platforms\SQLServerPlatform; use Doctrine\ORM\Query; class LimitSubqueryOutputWalkerTest extends PaginationTestCase @@ -19,7 +18,7 @@ class LimitSubqueryOutputWalkerTest extends PaginationTestCase $limitQuery->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Tools\Pagination\LimitSubqueryOutputWalker'); $this->assertEquals( - "SELECT DISTINCT id_0 FROM (SELECT m0_.id AS id_0, m0_.title AS title_1, c1_.id AS id_2, a2_.id AS id_3, a2_.name AS name_4, m0_.author_id AS author_id_5, m0_.category_id AS category_id_6 FROM MyBlogPost m0_ INNER JOIN Category c1_ ON m0_.category_id = c1_.id INNER JOIN Author a2_ ON m0_.author_id = a2_.id) dctrn_result", $limitQuery->getSql() + "SELECT DISTINCT id_0 FROM (SELECT m0_.id AS id_0, m0_.title AS title_1, c1_.id AS id_2, a2_.id AS id_3, a2_.name AS name_4, m0_.author_id AS author_id_5, m0_.category_id AS category_id_6 FROM MyBlogPost m0_ INNER JOIN Category c1_ ON m0_.category_id = c1_.id INNER JOIN Author a2_ ON m0_.author_id = a2_.id) dctrn_result", $limitQuery->getSQL() ); } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryWalkerTest.php index 597ec1350..fb11feb7a 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryWalkerTest.php @@ -19,7 +19,7 @@ class LimitSubqueryWalkerTest extends PaginationTestCase $this->assertEquals( "SELECT DISTINCT m0_.id AS id_0 FROM MyBlogPost m0_ INNER JOIN Category c1_ ON m0_.category_id = c1_.id INNER JOIN Author a2_ ON m0_.author_id = a2_.id", - $limitQuery->getSql() + $limitQuery->getSQL() ); } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/WhereInWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/WhereInWalkerTest.php index 41152dc5d..5f9a3430f 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/WhereInWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/WhereInWalkerTest.php @@ -20,7 +20,7 @@ class WhereInWalkerTest extends PaginationTestCase $whereInQuery->setHint(WhereInWalker::HINT_PAGINATOR_ID_COUNT, 10); $this->assertEquals( - "SELECT u0_.id AS id_0, g1_.id AS id_1 FROM User u0_ INNER JOIN user_group u2_ ON u0_.id = u2_.user_id INNER JOIN groups g1_ ON g1_.id = u2_.group_id WHERE u0_.id IN (?)", $whereInQuery->getSql() + "SELECT u0_.id AS id_0, g1_.id AS id_1 FROM User u0_ INNER JOIN user_group u2_ ON u0_.id = u2_.user_id INNER JOIN groups g1_ ON g1_.id = u2_.group_id WHERE u0_.id IN (?)", $whereInQuery->getSQL() ); } diff --git a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php index 2934693f8..28753078d 100644 --- a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php @@ -5,8 +5,9 @@ namespace Doctrine\Tests\ORM\Tools; use Doctrine\ORM\Mapping\ClassMetadataFactory; use Doctrine\ORM\Tools\ResolveTargetEntityListener; use Doctrine\ORM\Events; +use Doctrine\Tests\OrmTestCase; -class ResolveTargetEntityListenerTest extends \Doctrine\Tests\OrmTestCase +class ResolveTargetEntityListenerTest extends OrmTestCase { /** * @var \Doctrine\ORM\EntityManager diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php index fd2cd20f7..bc54744b9 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php @@ -6,8 +6,9 @@ use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Tools\ToolEvents; use Doctrine\ORM\Tools\Event\GenerateSchemaTableEventArgs; use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs; +use Doctrine\Tests\OrmTestCase; -class SchemaToolTest extends \Doctrine\Tests\OrmTestCase +class SchemaToolTest extends OrmTestCase { public function testAddUniqueIndexForUniqueFieldAnnotation() { diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php index 57305818b..a17d92e7f 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php @@ -2,9 +2,11 @@ namespace Doctrine\Tests\ORM\Tools; +use Doctrine\ORM\EntityManager; use Doctrine\ORM\Tools\SchemaValidator; +use Doctrine\Tests\OrmTestCase; -class SchemaValidatorTest extends \Doctrine\Tests\OrmTestCase +class SchemaValidatorTest extends OrmTestCase { /** * @var EntityManager diff --git a/tests/Doctrine/Tests/ORM/Tools/SetupTest.php b/tests/Doctrine/Tests/ORM/Tools/SetupTest.php index 20ad5ee0a..407baab3e 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SetupTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SetupTest.php @@ -4,15 +4,17 @@ namespace Doctrine\Tests\ORM\Tools; use Doctrine\ORM\Tools\Setup; use Doctrine\Common\Cache\ArrayCache; +use Doctrine\ORM\Version; +use Doctrine\Tests\OrmTestCase; -class SetupTest extends \Doctrine\Tests\OrmTestCase +class SetupTest extends OrmTestCase { private $originalAutoloaderCount; private $originalIncludePath; public function setUp() { - if (strpos(\Doctrine\ORM\Version::VERSION, "DEV") === false) { + if (strpos(Version::VERSION, "DEV") === false) { $this->markTestSkipped("Test only runs in a dev-installation from Github"); } diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index d855c7817..eb8bf3a5c 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -12,14 +12,16 @@ use Doctrine\Tests\Mocks\DriverMock; use Doctrine\Tests\Mocks\EntityManagerMock; use Doctrine\Tests\Mocks\EntityPersisterMock; use Doctrine\Tests\Mocks\UnitOfWorkMock; +use Doctrine\Tests\Models\CMS\CmsPhonenumber; use Doctrine\Tests\Models\Forum\ForumAvatar; use Doctrine\Tests\Models\Forum\ForumUser; +use Doctrine\Tests\OrmTestCase; use stdClass; /** * UnitOfWork tests. */ -class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase +class UnitOfWorkTest extends OrmTestCase { /** * SUT @@ -198,7 +200,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase $persister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber')); $this->_unitOfWork->setEntityPersister('Doctrine\Tests\Models\CMS\CmsPhonenumber', $persister); - $ph = new \Doctrine\Tests\Models\CMS\CmsPhonenumber(); + $ph = new CmsPhonenumber(); $ph->phonenumber = '12345'; $this->assertEquals(UnitOfWork::STATE_NEW, $this->_unitOfWork->getEntityState($ph)); @@ -210,7 +212,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase $this->_unitOfWork->registerManaged($ph, array('phonenumber' => '12345'), array()); $this->assertEquals(UnitOfWork::STATE_MANAGED, $this->_unitOfWork->getEntityState($ph)); $this->assertFalse($persister->isExistsCalled()); - $ph2 = new \Doctrine\Tests\Models\CMS\CmsPhonenumber(); + $ph2 = new CmsPhonenumber(); $ph2->phonenumber = '12345'; $this->assertEquals(UnitOfWork::STATE_DETACHED, $this->_unitOfWork->getEntityState($ph2)); $this->assertFalse($persister->isExistsCalled()); diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index d40b31082..a03031a16 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -2,7 +2,15 @@ namespace Doctrine\Tests; +use Doctrine\Common\Cache\ArrayCache; +use Doctrine\DBAL\Driver\PDOSqlite\Driver as SqliteDriver; +use Doctrine\DBAL\Logging\DebugStack; use Doctrine\DBAL\Types\Type; +use Doctrine\ORM\Cache\CacheConfiguration; +use Doctrine\ORM\Configuration; +use Doctrine\ORM\EntityManager; +use Doctrine\ORM\Tools\DebugUnitOfWorkListener; +use Doctrine\ORM\Tools\SchemaTool; use Doctrine\Tests\EventListener\CacheMetadataListener; use Doctrine\ORM\Cache\Logging\StatisticsCacheLogger; use Doctrine\ORM\Cache\DefaultCacheFactory; @@ -599,7 +607,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase if ( ! isset(static::$_sharedConn)) { static::$_sharedConn = TestUtil::getConnection(); - if (static::$_sharedConn->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { + if (static::$_sharedConn->getDriver() instanceof SqliteDriver) { $forceCreateTables = true; } } @@ -614,7 +622,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase if ( ! $this->_em) { $this->_em = $this->_getEntityManager(); - $this->_schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em); + $this->_schemaTool = new SchemaTool($this->_em); } $classes = array(); @@ -652,20 +660,20 @@ abstract class OrmFunctionalTestCase extends OrmTestCase if (isset($GLOBALS['DOCTRINE_CACHE_IMPL'])) { self::$_metadataCacheImpl = new $GLOBALS['DOCTRINE_CACHE_IMPL']; } else { - self::$_metadataCacheImpl = new \Doctrine\Common\Cache\ArrayCache; + self::$_metadataCacheImpl = new ArrayCache(); } } if (is_null(self::$_queryCacheImpl)) { - self::$_queryCacheImpl = new \Doctrine\Common\Cache\ArrayCache; + self::$_queryCacheImpl = new ArrayCache(); } - $this->_sqlLoggerStack = new \Doctrine\DBAL\Logging\DebugStack(); + $this->_sqlLoggerStack = new DebugStack(); $this->_sqlLoggerStack->enabled = false; //FIXME: two different configs! $conn and the created entity manager have // different configs. - $config = new \Doctrine\ORM\Configuration(); + $config = new Configuration(); $config->setMetadataCacheImpl(self::$_metadataCacheImpl); $config->setQueryCacheImpl(self::$_queryCacheImpl); $config->setProxyDir(__DIR__ . '/Proxies'); @@ -675,7 +683,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase if ($this->isSecondLevelCacheEnabled || $enableSecondLevelCache) { - $cacheConfig = new \Doctrine\ORM\Cache\CacheConfiguration(); + $cacheConfig = new CacheConfiguration(); $cache = $this->getSharedSecondLevelCacheDriverImpl(); $factory = new DefaultCacheFactory($cacheConfig->getRegionsConfiguration(), $cache); @@ -721,10 +729,10 @@ abstract class OrmFunctionalTestCase extends OrmTestCase } if (isset($GLOBALS['debug_uow_listener'])) { - $evm->addEventListener(array('onFlush'), new \Doctrine\ORM\Tools\DebugUnitOfWorkListener()); + $evm->addEventListener(array('onFlush'), new DebugUnitOfWorkListener()); } - return \Doctrine\ORM\EntityManager::create($conn, $config); + return EntityManager::create($conn, $config); } /** diff --git a/tests/Doctrine/Tests/OrmTestCase.php b/tests/Doctrine/Tests/OrmTestCase.php index 7cc9c0580..200f53450 100644 --- a/tests/Doctrine/Tests/OrmTestCase.php +++ b/tests/Doctrine/Tests/OrmTestCase.php @@ -5,7 +5,12 @@ namespace Doctrine\Tests; use Doctrine\Common\Annotations; use Doctrine\Common\Cache\ArrayCache; use Doctrine\Common\Version; +use Doctrine\DBAL\DriverManager; +use Doctrine\ORM\Cache\CacheConfiguration; use Doctrine\ORM\Cache\DefaultCacheFactory; +use Doctrine\ORM\Configuration; +use Doctrine\ORM\Mapping\Driver\AnnotationDriver; +use Doctrine\Tests\Mocks\EntityManagerMock; /** * Base testcase class for all ORM testcases. @@ -93,7 +98,7 @@ abstract class OrmTestCase extends DoctrineTestCase Annotations\AnnotationRegistry::registerFile(__DIR__ . "/../../../lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); - return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, (array) $paths); + return new AnnotationDriver($reader, (array) $paths); } /** @@ -117,7 +122,7 @@ abstract class OrmTestCase extends DoctrineTestCase ? self::getSharedMetadataCacheImpl() : new ArrayCache(); - $config = new \Doctrine\ORM\Configuration(); + $config = new Configuration(); $config->setMetadataCacheImpl($metadataCache); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(array(), true)); @@ -130,7 +135,7 @@ abstract class OrmTestCase extends DoctrineTestCase if ($this->isSecondLevelCacheEnabled) { - $cacheConfig = new \Doctrine\ORM\Cache\CacheConfiguration(); + $cacheConfig = new CacheConfiguration(); $cache = $this->getSharedSecondLevelCacheDriverImpl(); $factory = new DefaultCacheFactory($cacheConfig->getRegionsConfiguration(), $cache); @@ -151,10 +156,10 @@ abstract class OrmTestCase extends DoctrineTestCase } if (is_array($conn)) { - $conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager); + $conn = DriverManager::getConnection($conn, $config, $eventManager); } - return \Doctrine\Tests\Mocks\EntityManagerMock::create($conn, $config, $eventManager); + return EntityManagerMock::create($conn, $config, $eventManager); } protected function enableSecondLevelCache($log = true)