Use "::class" syntax on "tests" directory
This commit is contained in:
parent
512aa8a3c7
commit
fda6fdd9fb
@ -172,7 +172,7 @@ class CmsAddress
|
||||
[
|
||||
'name' => 'find-by-id',
|
||||
'query' => 'SELECT * FROM cms_addresses WHERE id = ?',
|
||||
'resultClass' => 'Doctrine\\Tests\\Models\\CMS\\CmsAddress',
|
||||
'resultClass' => CmsAddress::class,
|
||||
]
|
||||
);
|
||||
|
||||
@ -204,7 +204,7 @@ class CmsAddress
|
||||
'column' => 'country',
|
||||
],
|
||||
],
|
||||
'entityClass' => 'Doctrine\Tests\Models\CMS\CmsAddress',
|
||||
'entityClass' => CmsAddress::class,
|
||||
],
|
||||
],
|
||||
]
|
||||
@ -216,7 +216,7 @@ class CmsAddress
|
||||
'columns' => [],
|
||||
'entities' => [
|
||||
[
|
||||
'entityClass' => 'Doctrine\\Tests\\Models\\CMS\\CmsAddress',
|
||||
'entityClass' => CmsAddress::class,
|
||||
'fields' => []
|
||||
]
|
||||
]
|
||||
|
@ -281,7 +281,7 @@ class CmsUser
|
||||
[
|
||||
'name' => 'fetchIdAndUsernameWithResultClass',
|
||||
'query' => 'SELECT id, username FROM cms_users WHERE username = ?',
|
||||
'resultClass' => 'Doctrine\\Tests\\Models\\CMS\\CmsUser',
|
||||
'resultClass' => CmsUser::class,
|
||||
]
|
||||
);
|
||||
|
||||
@ -289,7 +289,7 @@ class CmsUser
|
||||
[
|
||||
'name' => 'fetchAllColumns',
|
||||
'query' => 'SELECT * FROM cms_users WHERE username = ?',
|
||||
'resultClass' => 'Doctrine\\Tests\\Models\\CMS\\CmsUser',
|
||||
'resultClass' => CmsUser::class,
|
||||
]
|
||||
);
|
||||
|
||||
@ -361,7 +361,7 @@ class CmsUser
|
||||
'column' => 'a_id',
|
||||
],
|
||||
],
|
||||
'entityClass' => 'Doctrine\Tests\Models\CMS\CmsUser',
|
||||
'entityClass' => CmsUser::class,
|
||||
'discriminatorColumn' => null
|
||||
],
|
||||
],
|
||||
@ -392,7 +392,7 @@ class CmsUser
|
||||
'column' => 'number',
|
||||
],
|
||||
],
|
||||
'entityClass' => 'Doctrine\\Tests\\Models\\CMS\\CmsUser',
|
||||
'entityClass' => CmsUser::class,
|
||||
'discriminatorColumn' => null
|
||||
],
|
||||
],
|
||||
@ -419,7 +419,7 @@ class CmsUser
|
||||
'column' => 'status',
|
||||
]
|
||||
],
|
||||
'entityClass' => 'Doctrine\Tests\Models\CMS\CmsUser',
|
||||
'entityClass' => CmsUser::class,
|
||||
'discriminatorColumn' => null
|
||||
]
|
||||
],
|
||||
@ -450,7 +450,7 @@ class CmsUser
|
||||
'column' => 'u_status',
|
||||
]
|
||||
],
|
||||
'entityClass' => 'Doctrine\Tests\Models\CMS\CmsUser',
|
||||
'entityClass' => CmsUser::class,
|
||||
'discriminatorColumn' => null,
|
||||
],
|
||||
[
|
||||
@ -468,7 +468,7 @@ class CmsUser
|
||||
'column' => 'a_country',
|
||||
],
|
||||
],
|
||||
'entityClass' => 'Doctrine\Tests\Models\CMS\CmsAddress',
|
||||
'entityClass' => CmsAddress::class,
|
||||
'discriminatorColumn' => null,
|
||||
],
|
||||
],
|
||||
|
@ -92,4 +92,4 @@ abstract class Attraction
|
||||
$this->infos->add($info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,4 +30,4 @@ class AttractionContactInfo extends AttractionInfo
|
||||
{
|
||||
$this->fone = $fone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,4 +51,4 @@ abstract class AttractionInfo
|
||||
|
||||
$attraction->addInfo($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,4 +30,4 @@ class AttractionLocationInfo extends AttractionInfo
|
||||
{
|
||||
$this->address = $address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,4 +106,4 @@ class City
|
||||
{
|
||||
include __DIR__ . '/../../ORM/Mapping/php/Doctrine.Tests.Models.Cache.City.php';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,4 +47,4 @@ class Country
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,4 +62,4 @@ class Flight
|
||||
{
|
||||
$this->departure = $departure;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,4 +89,4 @@ class State
|
||||
{
|
||||
$this->cities[] = $city;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,4 +109,4 @@ class Travel
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,4 +63,4 @@ class TravelerProfile
|
||||
{
|
||||
$this->info = $info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,4 +65,4 @@ class TravelerProfileInfo
|
||||
{
|
||||
$this->profile = $profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class CompanyPerson
|
||||
[
|
||||
'name' => 'fetchAllWithResultClass',
|
||||
'query' => 'SELECT id, name, discr FROM company_persons ORDER BY name',
|
||||
'resultClass' => 'Doctrine\\Tests\\Models\\Company\\CompanyPerson',
|
||||
'resultClass' => CompanyPerson::class,
|
||||
]
|
||||
);
|
||||
|
||||
@ -158,7 +158,7 @@ class CompanyPerson
|
||||
'column' => 'name',
|
||||
],
|
||||
],
|
||||
'entityClass' => 'Doctrine\Tests\Models\Company\CompanyPerson',
|
||||
'entityClass' => CompanyPerson::class,
|
||||
'discriminatorColumn' => 'discriminator',
|
||||
],
|
||||
],
|
||||
|
@ -34,4 +34,4 @@ class DDC3597Image extends DDC3597Media {
|
||||
public function getDimension() {
|
||||
return $this->dimension;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,4 +73,4 @@ abstract class DDC3597Media extends DDC3597Root {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -77,4 +77,4 @@ abstract class DDC3597Root {
|
||||
public function getUpdatedAt() {
|
||||
return $this->updatedAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +18,4 @@ class DDC3699Child extends DDC3699Parent
|
||||
|
||||
/** @OneToMany(targetEntity="DDC3699RelationMany", mappedBy="child") */
|
||||
public $relations;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class DDC869Payment
|
||||
]
|
||||
);
|
||||
$metadata->isMappedSuperclass = true;
|
||||
$metadata->setCustomRepositoryClass("Doctrine\Tests\Models\DDC869\DDC869PaymentRepository");
|
||||
$metadata->setCustomRepositoryClass(DDC869PaymentRepository::class);
|
||||
$metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_AUTO);
|
||||
}
|
||||
|
||||
|
@ -27,4 +27,4 @@ class DateTimeModel
|
||||
* @Column(name="col_time", type="time", nullable=true)
|
||||
*/
|
||||
public $time;
|
||||
}
|
||||
}
|
||||
|
@ -20,4 +20,4 @@ class CompositeToOneKeyState
|
||||
* @JoinColumn(referencedColumnName="country")
|
||||
*/
|
||||
public $country;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ use Doctrine\ORM\Cache\CacheConfiguration;
|
||||
use Doctrine\ORM\Cache\CacheFactory;
|
||||
use Doctrine\ORM\Cache\QueryCacheValidator;
|
||||
use Doctrine\ORM\Cache\Logging\CacheLogger;
|
||||
use Doctrine\ORM\Cache\TimestampQueryCacheValidator;
|
||||
use Doctrine\ORM\Cache\TimestampRegion;
|
||||
use Doctrine\Tests\DoctrineTestCase;
|
||||
|
||||
@ -75,7 +76,7 @@ class CacheConfigTest extends DoctrineTestCase
|
||||
|
||||
$validator = $this->createMock(QueryCacheValidator::class);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\TimestampQueryCacheValidator', $this->config->getQueryValidator());
|
||||
$this->assertInstanceOf(TimestampQueryCacheValidator::class, $this->config->getQueryValidator());
|
||||
|
||||
$this->config->setQueryValidator($validator);
|
||||
|
||||
|
@ -48,7 +48,7 @@ class CacheLoggerChainTest extends DoctrineTestCase
|
||||
public function testEntityCacheChain()
|
||||
{
|
||||
$name = 'my_entity_region';
|
||||
$key = new EntityCacheKey(State::CLASSNAME, ['id' => 1]);
|
||||
$key = new EntityCacheKey(State::class, ['id' => 1]);
|
||||
|
||||
$this->logger->setLogger('mock', $this->mock);
|
||||
|
||||
@ -72,7 +72,7 @@ class CacheLoggerChainTest extends DoctrineTestCase
|
||||
public function testCollectionCacheChain()
|
||||
{
|
||||
$name = 'my_collection_region';
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id' => 1]);
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id' => 1]);
|
||||
|
||||
$this->logger->setLogger('mock', $this->mock);
|
||||
|
||||
|
@ -4,14 +4,28 @@ namespace Doctrine\Tests\ORM\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
use Doctrine\Common\Cache\CacheProvider;
|
||||
use \Doctrine\Tests\OrmTestCase;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Cache\CacheFactory;
|
||||
use Doctrine\ORM\Cache\DefaultCacheFactory;
|
||||
use Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Collection\NonStrictReadWriteCachedCollectionPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Collection\ReadOnlyCachedCollectionPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Entity\NonStrictReadWriteCachedEntityPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Entity\ReadOnlyCachedEntityPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Entity\ReadWriteCachedEntityPersister;
|
||||
use Doctrine\ORM\Cache\Region\DefaultMultiGetRegion;
|
||||
use Doctrine\ORM\Cache\Region\DefaultRegion;
|
||||
use Doctrine\Tests\Mocks\ConcurrentRegionMock;
|
||||
use Doctrine\ORM\Persisters\Entity\BasicEntityPersister;
|
||||
use Doctrine\ORM\Persisters\Collection\OneToManyPersister;
|
||||
use Doctrine\ORM\Cache\RegionsConfiguration;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Persisters\Collection\OneToManyPersister;
|
||||
use Doctrine\ORM\Persisters\Entity\BasicEntityPersister;
|
||||
use Doctrine\Tests\Mocks\ConcurrentRegionMock;
|
||||
use Doctrine\Tests\Models\Cache\AttractionContactInfo;
|
||||
use Doctrine\Tests\Models\Cache\AttractionLocationInfo;
|
||||
use Doctrine\Tests\Models\Cache\City;
|
||||
use Doctrine\Tests\Models\Cache\State;
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
|
||||
/**
|
||||
* @group DDC-2183
|
||||
@ -49,14 +63,13 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
|
||||
public function testImplementsCacheFactory()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\CacheFactory', $this->factory);
|
||||
$this->assertInstanceOf(CacheFactory::class, $this->factory);
|
||||
}
|
||||
|
||||
public function testBuildCachedEntityPersisterReadOnly()
|
||||
{
|
||||
$em = $this->em;
|
||||
$entityName = 'Doctrine\Tests\Models\Cache\State';
|
||||
$metadata = clone $em->getClassMetadata($entityName);
|
||||
$metadata = clone $em->getClassMetadata(State::class);
|
||||
$persister = new BasicEntityPersister($em, $metadata);
|
||||
$region = new ConcurrentRegionMock(new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()));
|
||||
|
||||
@ -69,15 +82,14 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
|
||||
$cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, $metadata);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister', $cachedPersister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\ReadOnlyCachedEntityPersister', $cachedPersister);
|
||||
$this->assertInstanceOf(CachedEntityPersister::class, $cachedPersister);
|
||||
$this->assertInstanceOf(ReadOnlyCachedEntityPersister::class, $cachedPersister);
|
||||
}
|
||||
|
||||
public function testBuildCachedEntityPersisterReadWrite()
|
||||
{
|
||||
$em = $this->em;
|
||||
$entityName = 'Doctrine\Tests\Models\Cache\State';
|
||||
$metadata = clone $em->getClassMetadata($entityName);
|
||||
$metadata = clone $em->getClassMetadata(State::class);
|
||||
$persister = new BasicEntityPersister($em, $metadata);
|
||||
$region = new ConcurrentRegionMock(new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()));
|
||||
|
||||
@ -90,15 +102,14 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
|
||||
$cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, $metadata);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister', $cachedPersister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\ReadWriteCachedEntityPersister', $cachedPersister);
|
||||
$this->assertInstanceOf(CachedEntityPersister::class, $cachedPersister);
|
||||
$this->assertInstanceOf(ReadWriteCachedEntityPersister::class, $cachedPersister);
|
||||
}
|
||||
|
||||
public function testBuildCachedEntityPersisterNonStrictReadWrite()
|
||||
{
|
||||
$em = $this->em;
|
||||
$entityName = 'Doctrine\Tests\Models\Cache\State';
|
||||
$metadata = clone $em->getClassMetadata($entityName);
|
||||
$metadata = clone $em->getClassMetadata(State::class);
|
||||
$persister = new BasicEntityPersister($em, $metadata);
|
||||
$region = new ConcurrentRegionMock(new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()));
|
||||
|
||||
@ -111,15 +122,14 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
|
||||
$cachedPersister = $this->factory->buildCachedEntityPersister($em, $persister, $metadata);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister', $cachedPersister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\NonStrictReadWriteCachedEntityPersister', $cachedPersister);
|
||||
$this->assertInstanceOf(CachedEntityPersister::class, $cachedPersister);
|
||||
$this->assertInstanceOf(NonStrictReadWriteCachedEntityPersister::class, $cachedPersister);
|
||||
}
|
||||
|
||||
public function testBuildCachedCollectionPersisterReadOnly()
|
||||
{
|
||||
$em = $this->em;
|
||||
$entityName = 'Doctrine\Tests\Models\Cache\State';
|
||||
$metadata = $em->getClassMetadata($entityName);
|
||||
$metadata = $em->getClassMetadata(State::class);
|
||||
$mapping = $metadata->associationMappings['cities'];
|
||||
$persister = new OneToManyPersister($em);
|
||||
$region = new ConcurrentRegionMock(new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()));
|
||||
@ -134,15 +144,14 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
|
||||
$cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $mapping);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister', $cachedPersister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Collection\ReadOnlyCachedCollectionPersister', $cachedPersister);
|
||||
$this->assertInstanceOf(CachedCollectionPersister::class, $cachedPersister);
|
||||
$this->assertInstanceOf(ReadOnlyCachedCollectionPersister::class, $cachedPersister);
|
||||
}
|
||||
|
||||
public function testBuildCachedCollectionPersisterReadWrite()
|
||||
{
|
||||
$em = $this->em;
|
||||
$entityName = 'Doctrine\Tests\Models\Cache\State';
|
||||
$metadata = $em->getClassMetadata($entityName);
|
||||
$metadata = $em->getClassMetadata(State::class);
|
||||
$mapping = $metadata->associationMappings['cities'];
|
||||
$persister = new OneToManyPersister($em);
|
||||
$region = new ConcurrentRegionMock(new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()));
|
||||
@ -156,15 +165,14 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
|
||||
$cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $mapping);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister', $cachedPersister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister', $cachedPersister);
|
||||
$this->assertInstanceOf(CachedCollectionPersister::class, $cachedPersister);
|
||||
$this->assertInstanceOf(ReadWriteCachedCollectionPersister::class, $cachedPersister);
|
||||
}
|
||||
|
||||
public function testBuildCachedCollectionPersisterNonStrictReadWrite()
|
||||
{
|
||||
$em = $this->em;
|
||||
$entityName = 'Doctrine\Tests\Models\Cache\State';
|
||||
$metadata = $em->getClassMetadata($entityName);
|
||||
$metadata = $em->getClassMetadata(State::class);
|
||||
$mapping = $metadata->associationMappings['cities'];
|
||||
$persister = new OneToManyPersister($em);
|
||||
$region = new ConcurrentRegionMock(new DefaultRegion('regionName', $this->getSharedSecondLevelCacheDriverImpl()));
|
||||
@ -178,15 +186,15 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
|
||||
$cachedPersister = $this->factory->buildCachedCollectionPersister($em, $persister, $mapping);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister', $cachedPersister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Collection\NonStrictReadWriteCachedCollectionPersister', $cachedPersister);
|
||||
$this->assertInstanceOf(CachedCollectionPersister::class, $cachedPersister);
|
||||
$this->assertInstanceOf(NonStrictReadWriteCachedCollectionPersister::class, $cachedPersister);
|
||||
}
|
||||
|
||||
public function testInheritedEntityCacheRegion()
|
||||
{
|
||||
$em = $this->em;
|
||||
$metadata1 = clone $em->getClassMetadata('Doctrine\Tests\Models\Cache\AttractionContactInfo');
|
||||
$metadata2 = clone $em->getClassMetadata('Doctrine\Tests\Models\Cache\AttractionLocationInfo');
|
||||
$metadata1 = clone $em->getClassMetadata(AttractionContactInfo::class);
|
||||
$metadata2 = clone $em->getClassMetadata(AttractionLocationInfo::class);
|
||||
$persister1 = new BasicEntityPersister($em, $metadata1);
|
||||
$persister2 = new BasicEntityPersister($em, $metadata2);
|
||||
$factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
|
||||
@ -194,8 +202,8 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
$cachedPersister1 = $factory->buildCachedEntityPersister($em, $persister1, $metadata1);
|
||||
$cachedPersister2 = $factory->buildCachedEntityPersister($em, $persister2, $metadata2);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister', $cachedPersister1);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister', $cachedPersister2);
|
||||
$this->assertInstanceOf(CachedEntityPersister::class, $cachedPersister1);
|
||||
$this->assertInstanceOf(CachedEntityPersister::class, $cachedPersister2);
|
||||
|
||||
$this->assertNotSame($cachedPersister1, $cachedPersister2);
|
||||
$this->assertSame($cachedPersister1->getCacheRegion(), $cachedPersister2->getCacheRegion());
|
||||
@ -204,8 +212,8 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
public function testCreateNewCacheDriver()
|
||||
{
|
||||
$em = $this->em;
|
||||
$metadata1 = clone $em->getClassMetadata('Doctrine\Tests\Models\Cache\State');
|
||||
$metadata2 = clone $em->getClassMetadata('Doctrine\Tests\Models\Cache\City');
|
||||
$metadata1 = clone $em->getClassMetadata(State::class);
|
||||
$metadata2 = clone $em->getClassMetadata(City::class);
|
||||
$persister1 = new BasicEntityPersister($em, $metadata1);
|
||||
$persister2 = new BasicEntityPersister($em, $metadata2);
|
||||
$factory = new DefaultCacheFactory($this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl());
|
||||
@ -213,8 +221,8 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
$cachedPersister1 = $factory->buildCachedEntityPersister($em, $persister1, $metadata1);
|
||||
$cachedPersister2 = $factory->buildCachedEntityPersister($em, $persister2, $metadata2);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister', $cachedPersister1);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister', $cachedPersister2);
|
||||
$this->assertInstanceOf(CachedEntityPersister::class, $cachedPersister1);
|
||||
$this->assertInstanceOf(CachedEntityPersister::class, $cachedPersister2);
|
||||
|
||||
$this->assertNotSame($cachedPersister1, $cachedPersister2);
|
||||
$this->assertNotSame($cachedPersister1->getCacheRegion(), $cachedPersister2->getCacheRegion());
|
||||
@ -227,8 +235,7 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
public function testBuildCachedEntityPersisterNonStrictException()
|
||||
{
|
||||
$em = $this->em;
|
||||
$entityName = 'Doctrine\Tests\Models\Cache\State';
|
||||
$metadata = clone $em->getClassMetadata($entityName);
|
||||
$metadata = clone $em->getClassMetadata(State::class);
|
||||
$persister = new BasicEntityPersister($em, $metadata);
|
||||
|
||||
$metadata->cache['usage'] = -1;
|
||||
@ -243,8 +250,7 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
public function testBuildCachedCollectionPersisterException()
|
||||
{
|
||||
$em = $this->em;
|
||||
$entityName = 'Doctrine\Tests\Models\Cache\State';
|
||||
$metadata = $em->getClassMetadata($entityName);
|
||||
$metadata = $em->getClassMetadata(State::class);
|
||||
$mapping = $metadata->associationMappings['cities'];
|
||||
$persister = new OneToManyPersister($em);
|
||||
|
||||
@ -298,7 +304,7 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
$factory = new DefaultCacheFactory($this->regionsConfig, $cache);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Cache\Region\DefaultRegion',
|
||||
DefaultRegion::class,
|
||||
$factory->getRegion(
|
||||
[
|
||||
'region' => 'bar',
|
||||
@ -316,7 +322,7 @@ class DefaultCacheFactoryTest extends OrmTestCase
|
||||
$factory = new DefaultCacheFactory($this->regionsConfig, $cache);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Cache\Region\DefaultMultiGetRegion',
|
||||
DefaultMultiGetRegion::class,
|
||||
$factory->getRegion(
|
||||
[
|
||||
'region' => 'bar',
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Cache;
|
||||
|
||||
use Doctrine\ORM\Cache;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
use Doctrine\ORM\Cache\DefaultCache;
|
||||
use Doctrine\Tests\Models\Cache\State;
|
||||
@ -26,8 +28,6 @@ class DefaultCacheTest extends OrmTestCase
|
||||
*/
|
||||
private $em;
|
||||
|
||||
const NON_CACHEABLE_ENTITY = 'Doctrine\Tests\Models\CMS\CmsUser';
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::enableSecondLevelCache();
|
||||
@ -70,104 +70,104 @@ class DefaultCacheTest extends OrmTestCase
|
||||
|
||||
public function testImplementsCache()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache', $this->cache);
|
||||
$this->assertInstanceOf(Cache::class, $this->cache);
|
||||
}
|
||||
|
||||
public function testGetEntityCacheRegionAccess()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Region', $this->cache->getEntityCacheRegion(State::CLASSNAME));
|
||||
$this->assertNull($this->cache->getEntityCacheRegion(self::NON_CACHEABLE_ENTITY));
|
||||
$this->assertInstanceOf(Cache\Region::class, $this->cache->getEntityCacheRegion(State::class));
|
||||
$this->assertNull($this->cache->getEntityCacheRegion(CmsUser::class));
|
||||
}
|
||||
|
||||
public function testGetCollectionCacheRegionAccess()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Region', $this->cache->getCollectionCacheRegion(State::CLASSNAME, 'cities'));
|
||||
$this->assertNull($this->cache->getCollectionCacheRegion(self::NON_CACHEABLE_ENTITY, 'phonenumbers'));
|
||||
$this->assertInstanceOf(Cache\Region::class, $this->cache->getCollectionCacheRegion(State::class, 'cities'));
|
||||
$this->assertNull($this->cache->getCollectionCacheRegion(CmsUser::class, 'phonenumbers'));
|
||||
}
|
||||
|
||||
public function testContainsEntity()
|
||||
{
|
||||
$identifier = ['id'=>1];
|
||||
$className = Country::CLASSNAME;
|
||||
$className = Country::class;
|
||||
$cacheEntry = array_merge($identifier, ['name' => 'Brazil']);
|
||||
|
||||
$this->assertFalse($this->cache->containsEntity(Country::CLASSNAME, 1));
|
||||
$this->assertFalse($this->cache->containsEntity(Country::class, 1));
|
||||
|
||||
$this->putEntityCacheEntry($className, $identifier, $cacheEntry);
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(Country::CLASSNAME, 1));
|
||||
$this->assertFalse($this->cache->containsEntity(self::NON_CACHEABLE_ENTITY, 1));
|
||||
$this->assertTrue($this->cache->containsEntity(Country::class, 1));
|
||||
$this->assertFalse($this->cache->containsEntity(CmsUser::class, 1));
|
||||
}
|
||||
|
||||
public function testEvictEntity()
|
||||
{
|
||||
$identifier = ['id'=>1];
|
||||
$className = Country::CLASSNAME;
|
||||
$className = Country::class;
|
||||
$cacheEntry = array_merge($identifier, ['name' => 'Brazil']);
|
||||
|
||||
$this->putEntityCacheEntry($className, $identifier, $cacheEntry);
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(Country::CLASSNAME, 1));
|
||||
$this->assertTrue($this->cache->containsEntity(Country::class, 1));
|
||||
|
||||
$this->cache->evictEntity(Country::CLASSNAME, 1);
|
||||
$this->cache->evictEntity(self::NON_CACHEABLE_ENTITY, 1);
|
||||
$this->cache->evictEntity(Country::class, 1);
|
||||
$this->cache->evictEntity(CmsUser::class, 1);
|
||||
|
||||
$this->assertFalse($this->cache->containsEntity(Country::CLASSNAME, 1));
|
||||
$this->assertFalse($this->cache->containsEntity(Country::class, 1));
|
||||
}
|
||||
|
||||
public function testEvictEntityRegion()
|
||||
{
|
||||
$identifier = ['id'=>1];
|
||||
$className = Country::CLASSNAME;
|
||||
$className = Country::class;
|
||||
$cacheEntry = array_merge($identifier, ['name' => 'Brazil']);
|
||||
|
||||
$this->putEntityCacheEntry($className, $identifier, $cacheEntry);
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(Country::CLASSNAME, 1));
|
||||
$this->assertTrue($this->cache->containsEntity(Country::class, 1));
|
||||
|
||||
$this->cache->evictEntityRegion(Country::CLASSNAME);
|
||||
$this->cache->evictEntityRegion(self::NON_CACHEABLE_ENTITY);
|
||||
$this->cache->evictEntityRegion(Country::class);
|
||||
$this->cache->evictEntityRegion(CmsUser::class);
|
||||
|
||||
$this->assertFalse($this->cache->containsEntity(Country::CLASSNAME, 1));
|
||||
$this->assertFalse($this->cache->containsEntity(Country::class, 1));
|
||||
}
|
||||
|
||||
public function testEvictEntityRegions()
|
||||
{
|
||||
$identifier = ['id'=>1];
|
||||
$className = Country::CLASSNAME;
|
||||
$className = Country::class;
|
||||
$cacheEntry = array_merge($identifier, ['name' => 'Brazil']);
|
||||
|
||||
$this->putEntityCacheEntry($className, $identifier, $cacheEntry);
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(Country::CLASSNAME, 1));
|
||||
$this->assertTrue($this->cache->containsEntity(Country::class, 1));
|
||||
|
||||
$this->cache->evictEntityRegions();
|
||||
|
||||
$this->assertFalse($this->cache->containsEntity(Country::CLASSNAME, 1));
|
||||
$this->assertFalse($this->cache->containsEntity(Country::class, 1));
|
||||
}
|
||||
|
||||
public function testContainsCollection()
|
||||
{
|
||||
$ownerId = ['id'=>1];
|
||||
$className = State::CLASSNAME;
|
||||
$className = State::class;
|
||||
$association = 'cities';
|
||||
$cacheEntry = [
|
||||
['id' => 11],
|
||||
['id' => 12],
|
||||
];
|
||||
|
||||
$this->assertFalse($this->cache->containsCollection(State::CLASSNAME, $association, 1));
|
||||
$this->assertFalse($this->cache->containsCollection(State::class, $association, 1));
|
||||
|
||||
$this->putCollectionCacheEntry($className, $association, $ownerId, $cacheEntry);
|
||||
|
||||
$this->assertTrue($this->cache->containsCollection(State::CLASSNAME, $association, 1));
|
||||
$this->assertFalse($this->cache->containsCollection(self::NON_CACHEABLE_ENTITY, 'phonenumbers', 1));
|
||||
$this->assertTrue($this->cache->containsCollection(State::class, $association, 1));
|
||||
$this->assertFalse($this->cache->containsCollection(CmsUser::class, 'phonenumbers', 1));
|
||||
}
|
||||
|
||||
public function testEvictCollection()
|
||||
{
|
||||
$ownerId = ['id'=>1];
|
||||
$className = State::CLASSNAME;
|
||||
$className = State::class;
|
||||
$association = 'cities';
|
||||
$cacheEntry = [
|
||||
['id' => 11],
|
||||
@ -176,18 +176,18 @@ class DefaultCacheTest extends OrmTestCase
|
||||
|
||||
$this->putCollectionCacheEntry($className, $association, $ownerId, $cacheEntry);
|
||||
|
||||
$this->assertTrue($this->cache->containsCollection(State::CLASSNAME, $association, 1));
|
||||
$this->assertTrue($this->cache->containsCollection(State::class, $association, 1));
|
||||
|
||||
$this->cache->evictCollection($className, $association, $ownerId);
|
||||
$this->cache->evictCollection(self::NON_CACHEABLE_ENTITY, 'phonenumbers', 1);
|
||||
$this->cache->evictCollection(CmsUser::class, 'phonenumbers', 1);
|
||||
|
||||
$this->assertFalse($this->cache->containsCollection(State::CLASSNAME, $association, 1));
|
||||
$this->assertFalse($this->cache->containsCollection(State::class, $association, 1));
|
||||
}
|
||||
|
||||
public function testEvictCollectionRegion()
|
||||
{
|
||||
$ownerId = ['id'=>1];
|
||||
$className = State::CLASSNAME;
|
||||
$className = State::class;
|
||||
$association = 'cities';
|
||||
$cacheEntry = [
|
||||
['id' => 11],
|
||||
@ -196,18 +196,18 @@ class DefaultCacheTest extends OrmTestCase
|
||||
|
||||
$this->putCollectionCacheEntry($className, $association, $ownerId, $cacheEntry);
|
||||
|
||||
$this->assertTrue($this->cache->containsCollection(State::CLASSNAME, $association, 1));
|
||||
$this->assertTrue($this->cache->containsCollection(State::class, $association, 1));
|
||||
|
||||
$this->cache->evictCollectionRegion($className, $association);
|
||||
$this->cache->evictCollectionRegion(self::NON_CACHEABLE_ENTITY, 'phonenumbers');
|
||||
$this->cache->evictCollectionRegion(CmsUser::class, 'phonenumbers');
|
||||
|
||||
$this->assertFalse($this->cache->containsCollection(State::CLASSNAME, $association, 1));
|
||||
$this->assertFalse($this->cache->containsCollection(State::class, $association, 1));
|
||||
}
|
||||
|
||||
public function testEvictCollectionRegions()
|
||||
{
|
||||
$ownerId = ['id'=>1];
|
||||
$className = State::CLASSNAME;
|
||||
$className = State::class;
|
||||
$association = 'cities';
|
||||
$cacheEntry = [
|
||||
['id' => 11],
|
||||
@ -216,11 +216,11 @@ class DefaultCacheTest extends OrmTestCase
|
||||
|
||||
$this->putCollectionCacheEntry($className, $association, $ownerId, $cacheEntry);
|
||||
|
||||
$this->assertTrue($this->cache->containsCollection(State::CLASSNAME, $association, 1));
|
||||
$this->assertTrue($this->cache->containsCollection(State::class, $association, 1));
|
||||
|
||||
$this->cache->evictCollectionRegions();
|
||||
|
||||
$this->assertFalse($this->cache->containsCollection(State::CLASSNAME, $association, 1));
|
||||
$this->assertFalse($this->cache->containsCollection(State::class, $association, 1));
|
||||
}
|
||||
|
||||
public function testQueryCache()
|
||||
@ -230,8 +230,8 @@ class DefaultCacheTest extends OrmTestCase
|
||||
$defaultQueryCache = $this->cache->getQueryCache();
|
||||
$fooQueryCache = $this->cache->getQueryCache('foo');
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\QueryCache', $defaultQueryCache);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\QueryCache', $fooQueryCache);
|
||||
$this->assertInstanceOf(Cache\QueryCache::class, $defaultQueryCache);
|
||||
$this->assertInstanceOf(Cache\QueryCache::class, $fooQueryCache);
|
||||
$this->assertSame($defaultQueryCache, $this->cache->getQueryCache());
|
||||
$this->assertSame($fooQueryCache, $this->cache->getQueryCache('foo'));
|
||||
|
||||
@ -249,7 +249,7 @@ class DefaultCacheTest extends OrmTestCase
|
||||
{
|
||||
$identifier = 123;
|
||||
$entity = new Country('Foo');
|
||||
$metadata = $this->em->getClassMetadata(Country::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(Country::class);
|
||||
$method = new \ReflectionMethod($this->cache, 'toIdentifierArray');
|
||||
$property = new \ReflectionProperty($entity, 'id');
|
||||
|
||||
|
@ -2,17 +2,17 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Cache;
|
||||
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\Tests\Models\Cache\State;
|
||||
use Doctrine\Tests\Models\Cache\City;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Doctrine\ORM\Cache\EntityCacheKey;
|
||||
use Doctrine\ORM\Cache\EntityCacheEntry;
|
||||
use Doctrine\ORM\Cache\CollectionCacheKey;
|
||||
use Doctrine\ORM\Cache\CollectionCacheEntry;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Cache\CollectionCacheEntry;
|
||||
use Doctrine\ORM\Cache\CollectionCacheKey;
|
||||
use Doctrine\ORM\Cache\DefaultCollectionHydrator;
|
||||
use Doctrine\ORM\Cache\EntityCacheEntry;
|
||||
use Doctrine\ORM\Cache\EntityCacheKey;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use Doctrine\Tests\Models\Cache\City;
|
||||
use Doctrine\Tests\Models\Cache\State;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
* @group DDC-2183
|
||||
@ -29,32 +29,32 @@ class DefaultCollectionHydratorTest extends OrmFunctionalTestCase
|
||||
$this->enableSecondLevelCache();
|
||||
parent::setUp();
|
||||
|
||||
$targetPersister = $this->_em->getUnitOfWork()->getEntityPersister(City::CLASSNAME);
|
||||
$targetPersister = $this->_em->getUnitOfWork()->getEntityPersister(City::class);
|
||||
$this->structure = new DefaultCollectionHydrator($this->_em, $targetPersister);
|
||||
}
|
||||
|
||||
public function testImplementsCollectionEntryStructure()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\DefaultCollectionHydrator', $this->structure);
|
||||
$this->assertInstanceOf(DefaultCollectionHydrator::class, $this->structure);
|
||||
}
|
||||
|
||||
public function testLoadCacheCollection()
|
||||
{
|
||||
$targetRegion = $this->_em->getCache()->getEntityCacheRegion(City::CLASSNAME);
|
||||
$targetRegion = $this->_em->getCache()->getEntityCacheRegion(City::class);
|
||||
$entry = new CollectionCacheEntry(
|
||||
[
|
||||
new EntityCacheKey(City::CLASSNAME, ['id'=>31]),
|
||||
new EntityCacheKey(City::CLASSNAME, ['id'=>32]),
|
||||
new EntityCacheKey(City::class, ['id'=>31]),
|
||||
new EntityCacheKey(City::class, ['id'=>32]),
|
||||
]
|
||||
);
|
||||
|
||||
$targetRegion->put(new EntityCacheKey(City::CLASSNAME, ['id'=>31]), new EntityCacheEntry(City::CLASSNAME, ['id'=>31, 'name'=>'Foo']
|
||||
$targetRegion->put(new EntityCacheKey(City::class, ['id'=>31]), new EntityCacheEntry(City::class, ['id'=>31, 'name'=>'Foo']
|
||||
));
|
||||
$targetRegion->put(new EntityCacheKey(City::CLASSNAME, ['id'=>32]), new EntityCacheEntry(City::CLASSNAME, ['id'=>32, 'name'=>'Bar']
|
||||
$targetRegion->put(new EntityCacheKey(City::class, ['id'=>32]), new EntityCacheEntry(City::class, ['id'=>32, 'name'=>'Bar']
|
||||
));
|
||||
|
||||
$sourceClass = $this->_em->getClassMetadata(State::CLASSNAME);
|
||||
$targetClass = $this->_em->getClassMetadata(City::CLASSNAME);
|
||||
$sourceClass = $this->_em->getClassMetadata(State::class);
|
||||
$targetClass = $this->_em->getClassMetadata(City::class);
|
||||
$key = new CollectionCacheKey($sourceClass->name, 'cities', ['id'=>21]);
|
||||
$collection = new PersistentCollection($this->_em, $targetClass, new ArrayCollection());
|
||||
$list = $this->structure->loadCacheEntry($sourceClass, $key, $entry, $collection);
|
||||
|
@ -2,15 +2,15 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Cache;
|
||||
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
use Doctrine\Tests\Models\Cache\State;
|
||||
use Doctrine\Tests\Models\Cache\Country;
|
||||
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use Doctrine\ORM\Cache\EntityCacheKey;
|
||||
use Doctrine\ORM\Cache\EntityCacheEntry;
|
||||
use Doctrine\ORM\Cache\DefaultEntityHydrator;
|
||||
use Doctrine\ORM\Cache\AssociationCacheEntry;
|
||||
use Doctrine\ORM\Cache\CacheEntry;
|
||||
use Doctrine\ORM\Cache\DefaultEntityHydrator;
|
||||
use Doctrine\ORM\Cache\EntityCacheEntry;
|
||||
use Doctrine\ORM\Cache\EntityCacheKey;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use Doctrine\Tests\Models\Cache\Country;
|
||||
use Doctrine\Tests\Models\Cache\State;
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
|
||||
/**
|
||||
* @group DDC-2183
|
||||
@ -42,7 +42,7 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
|
||||
public function testCreateEntity()
|
||||
{
|
||||
$metadata = $this->em->getClassMetadata(Country::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(Country::class);
|
||||
$key = new EntityCacheKey($metadata->name, ['id'=>1]);
|
||||
$entry = new EntityCacheEntry($metadata->name, ['id'=>1, 'name'=>'Foo']);
|
||||
$entity = $this->structure->loadCacheEntry($metadata, $key, $entry);
|
||||
@ -56,7 +56,7 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
|
||||
public function testLoadProxy()
|
||||
{
|
||||
$metadata = $this->em->getClassMetadata(Country::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(Country::class);
|
||||
$key = new EntityCacheKey($metadata->name, ['id'=>1]);
|
||||
$entry = new EntityCacheEntry($metadata->name, ['id'=>1, 'name'=>'Foo']);
|
||||
$proxy = $this->em->getReference($metadata->name, $key->identifier);
|
||||
@ -75,7 +75,7 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
$entity = new Country('Foo');
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$data = ['id'=>1, 'name'=>'Foo'];
|
||||
$metadata = $this->em->getClassMetadata(Country::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(Country::class);
|
||||
$key = new EntityCacheKey($metadata->name, ['id'=>1]);
|
||||
|
||||
$entity->setId(1);
|
||||
@ -83,8 +83,8 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
|
||||
$cache = $this->structure->buildCacheEntry($metadata, $key, $entity);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\CacheEntry', $cache);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheEntry', $cache);
|
||||
$this->assertInstanceOf(CacheEntry::class, $cache);
|
||||
$this->assertInstanceOf(EntityCacheEntry::class, $cache);
|
||||
|
||||
$this->assertArrayHasKey('id', $cache->data);
|
||||
$this->assertArrayHasKey('name', $cache->data);
|
||||
@ -102,7 +102,7 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$countryData = ['id'=>11, 'name'=>'Foo'];
|
||||
$stateData = ['id'=>12, 'name'=>'Bar', 'country' => $country];
|
||||
$metadata = $this->em->getClassMetadata(State::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(State::class);
|
||||
$key = new EntityCacheKey($metadata->name, ['id'=>11]);
|
||||
|
||||
$country->setId(11);
|
||||
@ -113,8 +113,8 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
|
||||
$cache = $this->structure->buildCacheEntry($metadata, $key, $state);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\CacheEntry', $cache);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheEntry', $cache);
|
||||
$this->assertInstanceOf(CacheEntry::class, $cache);
|
||||
$this->assertInstanceOf(EntityCacheEntry::class, $cache);
|
||||
|
||||
$this->assertArrayHasKey('id', $cache->data);
|
||||
$this->assertArrayHasKey('name', $cache->data);
|
||||
@ -123,17 +123,17 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
[
|
||||
'id' => 12,
|
||||
'name' => 'Bar',
|
||||
'country' => new AssociationCacheEntry(Country::CLASSNAME, ['id' => 11]),
|
||||
'country' => new AssociationCacheEntry(Country::class, ['id' => 11]),
|
||||
], $cache->data);
|
||||
}
|
||||
|
||||
public function testBuildCacheEntryNonInitializedAssocProxy()
|
||||
{
|
||||
$proxy = $this->em->getReference(Country::CLASSNAME, 11);
|
||||
$proxy = $this->em->getReference(Country::class, 11);
|
||||
$entity = new State('Bat', $proxy);
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$entityData = ['id'=>12, 'name'=>'Bar', 'country' => $proxy];
|
||||
$metadata = $this->em->getClassMetadata(State::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(State::class);
|
||||
$key = new EntityCacheKey($metadata->name, ['id'=>11]);
|
||||
|
||||
$entity->setId(12);
|
||||
@ -142,8 +142,8 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
|
||||
$cache = $this->structure->buildCacheEntry($metadata, $key, $entity);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\CacheEntry', $cache);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheEntry', $cache);
|
||||
$this->assertInstanceOf(CacheEntry::class, $cache);
|
||||
$this->assertInstanceOf(EntityCacheEntry::class, $cache);
|
||||
|
||||
$this->assertArrayHasKey('id', $cache->data);
|
||||
$this->assertArrayHasKey('name', $cache->data);
|
||||
@ -152,17 +152,17 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
[
|
||||
'id' => 12,
|
||||
'name' => 'Bar',
|
||||
'country' => new AssociationCacheEntry(Country::CLASSNAME, ['id' => 11]),
|
||||
'country' => new AssociationCacheEntry(Country::class, ['id' => 11]),
|
||||
], $cache->data);
|
||||
}
|
||||
|
||||
public function testCacheEntryWithWrongIdentifierType()
|
||||
{
|
||||
$proxy = $this->em->getReference(Country::CLASSNAME, 11);
|
||||
$proxy = $this->em->getReference(Country::class, 11);
|
||||
$entity = new State('Bat', $proxy);
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$entityData = ['id'=> 12, 'name'=>'Bar', 'country' => $proxy];
|
||||
$metadata = $this->em->getClassMetadata(State::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(State::class);
|
||||
$key = new EntityCacheKey($metadata->name, ['id'=>'12']);
|
||||
|
||||
$entity->setId(12);
|
||||
@ -171,8 +171,8 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
|
||||
$cache = $this->structure->buildCacheEntry($metadata, $key, $entity);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\CacheEntry', $cache);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheEntry', $cache);
|
||||
$this->assertInstanceOf(CacheEntry::class, $cache);
|
||||
$this->assertInstanceOf(EntityCacheEntry::class, $cache);
|
||||
|
||||
$this->assertArrayHasKey('id', $cache->data);
|
||||
$this->assertArrayHasKey('name', $cache->data);
|
||||
@ -182,7 +182,7 @@ class DefaultEntityHydratorTest extends OrmTestCase
|
||||
[
|
||||
'id' => 12,
|
||||
'name' => 'Bar',
|
||||
'country' => new AssociationCacheEntry(Country::CLASSNAME, ['id' => 11]),
|
||||
'country' => new AssociationCacheEntry(Country::class, ['id' => 11]),
|
||||
], $cache->data);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Cache;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Cache\EntityCacheKey;
|
||||
use Doctrine\ORM\Cache\QueryCache;
|
||||
use Doctrine\Tests\Mocks\TimestampRegionMock;
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
use Doctrine\Tests\Mocks\CacheRegionMock;
|
||||
@ -61,7 +64,7 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
|
||||
public function testImplementQueryCache()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\QueryCache', $this->queryCache);
|
||||
$this->assertInstanceOf(QueryCache::class, $this->queryCache);
|
||||
}
|
||||
|
||||
public function testGetRegion()
|
||||
@ -82,9 +85,9 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$result = [];
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$metadata = $this->em->getClassMetadata(Country::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(Country::class);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(Country::CLASSNAME, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(Country::class, 'c');
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$name = "Country $i";
|
||||
@ -99,17 +102,17 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$this->assertArrayHasKey('put', $this->region->calls);
|
||||
$this->assertCount(5, $this->region->calls['put']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][0]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][1]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][2]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][3]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\QueryCacheKey', $this->region->calls['put'][4]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][0]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][1]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][2]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][3]['key']);
|
||||
$this->assertInstanceOf(QueryCacheKey::class, $this->region->calls['put'][4]['key']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheEntry', $this->region->calls['put'][0]['entry']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheEntry', $this->region->calls['put'][1]['entry']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheEntry', $this->region->calls['put'][2]['entry']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheEntry', $this->region->calls['put'][3]['entry']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\QueryCacheEntry', $this->region->calls['put'][4]['entry']);
|
||||
$this->assertInstanceOf(EntityCacheEntry::class, $this->region->calls['put'][0]['entry']);
|
||||
$this->assertInstanceOf(EntityCacheEntry::class, $this->region->calls['put'][1]['entry']);
|
||||
$this->assertInstanceOf(EntityCacheEntry::class, $this->region->calls['put'][2]['entry']);
|
||||
$this->assertInstanceOf(EntityCacheEntry::class, $this->region->calls['put'][3]['entry']);
|
||||
$this->assertInstanceOf(QueryCacheEntry::class, $this->region->calls['put'][4]['entry']);
|
||||
}
|
||||
|
||||
public function testPutToOneAssociationQueryResult()
|
||||
@ -118,11 +121,11 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$cityClass = $this->em->getClassMetadata(City::CLASSNAME);
|
||||
$stateClass = $this->em->getClassMetadata(State::CLASSNAME);
|
||||
$cityClass = $this->em->getClassMetadata(City::class);
|
||||
$stateClass = $this->em->getClassMetadata(State::class);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(City::CLASSNAME, 'c');
|
||||
$rsm->addJoinedEntityFromClassMetadata(State::CLASSNAME, 's', 'c', 'state', ['id'=>'state_id', 'name'=>'state_name']
|
||||
$rsm->addRootEntityFromClassMetadata(City::class, 'c');
|
||||
$rsm->addJoinedEntityFromClassMetadata(State::class, 's', 'c', 'state', ['id'=>'state_id', 'name'=>'state_name']
|
||||
);
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
@ -141,15 +144,15 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$this->assertArrayHasKey('put', $this->region->calls);
|
||||
$this->assertCount(9, $this->region->calls['put']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][0]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][1]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][2]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][3]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][4]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][5]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][6]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][7]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\QueryCacheKey', $this->region->calls['put'][8]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][0]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][1]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][2]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][3]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][4]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][5]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][6]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][7]['key']);
|
||||
$this->assertInstanceOf(QueryCacheKey::class, $this->region->calls['put'][8]['key']);
|
||||
}
|
||||
|
||||
public function testPutToOneAssociation2LevelsQueryResult()
|
||||
@ -158,14 +161,14 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$cityClass = $this->em->getClassMetadata(City::CLASSNAME);
|
||||
$stateClass = $this->em->getClassMetadata(State::CLASSNAME);
|
||||
$countryClass = $this->em->getClassMetadata(Country::CLASSNAME);
|
||||
$cityClass = $this->em->getClassMetadata(City::class);
|
||||
$stateClass = $this->em->getClassMetadata(State::class);
|
||||
$countryClass = $this->em->getClassMetadata(Country::class);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(City::CLASSNAME, 'c');
|
||||
$rsm->addJoinedEntityFromClassMetadata(State::CLASSNAME, 's', 'c', 'state', ['id'=>'state_id', 'name'=>'state_name']
|
||||
$rsm->addRootEntityFromClassMetadata(City::class, 'c');
|
||||
$rsm->addJoinedEntityFromClassMetadata(State::class, 's', 'c', 'state', ['id'=>'state_id', 'name'=>'state_name']
|
||||
);
|
||||
$rsm->addJoinedEntityFromClassMetadata(Country::CLASSNAME, 'co', 's', 'country', ['id'=>'country_id', 'name'=>'country_name']
|
||||
$rsm->addJoinedEntityFromClassMetadata(Country::class, 'co', 's', 'country', ['id'=>'country_id', 'name'=>'country_name']
|
||||
);
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
@ -189,19 +192,19 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$this->assertArrayHasKey('put', $this->region->calls);
|
||||
$this->assertCount(13, $this->region->calls['put']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][0]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][1]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][2]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][3]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][4]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][5]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][6]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][7]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][8]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][9]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][10]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][11]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\QueryCacheKey', $this->region->calls['put'][12]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][0]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][1]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][2]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][3]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][4]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][5]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][6]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][7]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][8]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][9]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][10]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][11]['key']);
|
||||
$this->assertInstanceOf(QueryCacheKey::class, $this->region->calls['put'][12]['key']);
|
||||
}
|
||||
|
||||
public function testPutToOneAssociationNullQueryResult()
|
||||
@ -210,10 +213,10 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$cityClass = $this->em->getClassMetadata(City::CLASSNAME);
|
||||
$cityClass = $this->em->getClassMetadata(City::class);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(City::CLASSNAME, 'c');
|
||||
$rsm->addJoinedEntityFromClassMetadata(State::CLASSNAME, 's', 'c', 'state', ['id'=>'state_id', 'name'=>'state_name']
|
||||
$rsm->addRootEntityFromClassMetadata(City::class, 'c');
|
||||
$rsm->addJoinedEntityFromClassMetadata(State::class, 's', 'c', 'state', ['id'=>'state_id', 'name'=>'state_name']
|
||||
);
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
@ -229,11 +232,11 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$this->assertArrayHasKey('put', $this->region->calls);
|
||||
$this->assertCount(5, $this->region->calls['put']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][0]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][1]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][2]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\EntityCacheKey', $this->region->calls['put'][3]['key']);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\QueryCacheKey', $this->region->calls['put'][4]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][0]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][1]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][2]['key']);
|
||||
$this->assertInstanceOf(EntityCacheKey::class, $this->region->calls['put'][3]['key']);
|
||||
$this->assertInstanceOf(QueryCacheKey::class, $this->region->calls['put'][4]['key']);
|
||||
}
|
||||
|
||||
public function testPutToManyAssociationQueryResult()
|
||||
@ -242,11 +245,11 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$cityClass = $this->em->getClassMetadata(City::CLASSNAME);
|
||||
$stateClass = $this->em->getClassMetadata(State::CLASSNAME);
|
||||
$cityClass = $this->em->getClassMetadata(City::class);
|
||||
$stateClass = $this->em->getClassMetadata(State::class);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(State::CLASSNAME, 's');
|
||||
$rsm->addJoinedEntityFromClassMetadata(City::CLASSNAME, 'c', 's', 'cities', ['id'=>'c_id', 'name'=>'c_name']);
|
||||
$rsm->addRootEntityFromClassMetadata(State::class, 's');
|
||||
$rsm->addJoinedEntityFromClassMetadata(City::class, 'c', 's', 'cities', ['id'=>'c_id', 'name'=>'c_name']);
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$state = new State("State $i");
|
||||
@ -291,16 +294,16 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
];
|
||||
|
||||
$this->region->addReturn('get', $entry);
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::CLASSNAME, $data[0]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::CLASSNAME, $data[1]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::class, $data[0]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::class, $data[1]));
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(Country::CLASSNAME, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(Country::class, 'c');
|
||||
|
||||
$result = $this->queryCache->get($key, $rsm);
|
||||
|
||||
$this->assertCount(2, $result);
|
||||
$this->assertInstanceOf(Country::CLASSNAME, $result[0]);
|
||||
$this->assertInstanceOf(Country::CLASSNAME, $result[1]);
|
||||
$this->assertInstanceOf(Country::class, $result[0]);
|
||||
$this->assertInstanceOf(Country::class, $result[1]);
|
||||
$this->assertEquals(1, $result[0]->getId());
|
||||
$this->assertEquals(2, $result[1]->getId());
|
||||
$this->assertEquals('Foo', $result[0]->getName());
|
||||
@ -312,9 +315,9 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$result = [];
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$metadata = $this->em->getClassMetadata(Country::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(Country::class);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(Country::CLASSNAME, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(Country::class, 'c');
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$name = "Country $i";
|
||||
@ -338,11 +341,11 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$cityClass = $this->em->getClassMetadata(City::CLASSNAME);
|
||||
$stateClass = $this->em->getClassMetadata(State::CLASSNAME);
|
||||
$cityClass = $this->em->getClassMetadata(City::class);
|
||||
$stateClass = $this->em->getClassMetadata(State::class);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(City::CLASSNAME, 'c');
|
||||
$rsm->addJoinedEntityFromClassMetadata(State::CLASSNAME, 's', 'c', 'state', ['id'=>'state_id', 'name'=>'state_name']
|
||||
$rsm->addRootEntityFromClassMetadata(City::class, 'c');
|
||||
$rsm->addJoinedEntityFromClassMetadata(State::class, 's', 'c', 'state', ['id'=>'state_id', 'name'=>'state_name']
|
||||
);
|
||||
|
||||
$state = new State("State 1");
|
||||
@ -367,11 +370,11 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$uow = $this->em->getUnitOfWork();
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$cityClass = $this->em->getClassMetadata(City::CLASSNAME);
|
||||
$stateClass = $this->em->getClassMetadata(State::CLASSNAME);
|
||||
$cityClass = $this->em->getClassMetadata(City::class);
|
||||
$stateClass = $this->em->getClassMetadata(State::class);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(State::CLASSNAME, 's');
|
||||
$rsm->addJoinedEntityFromClassMetadata(City::CLASSNAME, 'c', 's', 'cities', ['id'=>'c_id', 'name'=>'c_name']);
|
||||
$rsm->addRootEntityFromClassMetadata(State::class, 's');
|
||||
$rsm->addJoinedEntityFromClassMetadata(City::class, 'c', 's', 'cities', ['id'=>'c_id', 'name'=>'c_name']);
|
||||
|
||||
$state = new State("State");
|
||||
$city1 = new City("City 1", $state);
|
||||
@ -409,7 +412,7 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
]
|
||||
);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(Country::CLASSNAME, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(Country::class, 'c');
|
||||
|
||||
$this->region->addReturn('get', $entry);
|
||||
|
||||
@ -420,10 +423,10 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
{
|
||||
$result = [];
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$metadata = $this->em->getClassMetadata(Country::CLASSNAME);
|
||||
$metadata = $this->em->getClassMetadata(Country::class);
|
||||
$key = new QueryCacheKey('query.key1', 0, Cache::MODE_GET);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(Country::CLASSNAME, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(Country::class, 'c');
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$name = "Country $i";
|
||||
@ -455,10 +458,10 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$entry->time = microtime(true) - 100;
|
||||
|
||||
$this->region->addReturn('get', $entry);
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::CLASSNAME, $entities[0]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::CLASSNAME, $entities[1]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::class, $entities[0]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::class, $entities[1]));
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(Country::CLASSNAME, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(Country::class, 'c');
|
||||
|
||||
$this->assertNull($this->queryCache->get($key, $rsm));
|
||||
}
|
||||
@ -480,10 +483,10 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
];
|
||||
|
||||
$this->region->addReturn('get', $entry);
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::CLASSNAME, $data[0]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::CLASSNAME, $data[1]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::class, $data[0]));
|
||||
$this->region->addReturn('get', new EntityCacheEntry(Country::class, $data[1]));
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(Country::CLASSNAME, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(Country::class, 'c');
|
||||
|
||||
$this->assertNull($this->queryCache->get($key, $rsm));
|
||||
}
|
||||
@ -502,7 +505,7 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$this->region->addReturn('get', $entry);
|
||||
$this->region->addReturn('get', null);
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(Country::CLASSNAME, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(Country::class, 'c');
|
||||
|
||||
$this->assertNull($this->queryCache->get($key, $rsm));
|
||||
}
|
||||
@ -527,13 +530,13 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$munich->addAttraction(new Restaurant('Schneider Weisse', $munich));
|
||||
$wurzburg->addAttraction(new Restaurant('Fischers Fritz', $wurzburg));
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata(State::CLASSNAME, 's');
|
||||
$rsm->addJoinedEntityFromClassMetadata(City::CLASSNAME, 'c', 's', 'cities', [
|
||||
$rsm->addRootEntityFromClassMetadata(State::class, 's');
|
||||
$rsm->addJoinedEntityFromClassMetadata(City::class, 'c', 's', 'cities', [
|
||||
'id' => 'c_id',
|
||||
'name' => 'c_name'
|
||||
]
|
||||
);
|
||||
$rsm->addJoinedEntityFromClassMetadata(Restaurant::CLASSNAME, 'a', 'c', 'attractions', [
|
||||
$rsm->addJoinedEntityFromClassMetadata(Restaurant::class, 'a', 'c', 'attractions', [
|
||||
'id' => 'a_id',
|
||||
'name' => 'a_name'
|
||||
]
|
||||
@ -545,9 +548,9 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$this->assertCount(2, $cities);
|
||||
$this->assertCount(2, $attractions);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $cities);
|
||||
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $attractions[0]);
|
||||
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $attractions[1]);
|
||||
$this->assertInstanceOf(Collection::class, $cities);
|
||||
$this->assertInstanceOf(Collection::class, $attractions[0]);
|
||||
$this->assertInstanceOf(Collection::class, $attractions[1]);
|
||||
|
||||
$this->assertCount(2, $attractions[0]);
|
||||
$this->assertCount(1, $attractions[1]);
|
||||
@ -578,8 +581,8 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\Cache\City', 'e1');
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\Cache\State', 'e2');
|
||||
$rsm->addEntityResult(City::class, 'e1');
|
||||
$rsm->addEntityResult(State::class, 'e2');
|
||||
|
||||
$this->queryCache->put($key, $rsm, $result);
|
||||
}
|
||||
@ -593,9 +596,7 @@ class DefaultQueryCacheTest extends OrmTestCase
|
||||
$result = [];
|
||||
$key = new QueryCacheKey('query.key1', 0);
|
||||
$rsm = new ResultSetMappingBuilder($this->em);
|
||||
$className = 'Doctrine\Tests\Models\Generic\BooleanModel';
|
||||
|
||||
$rsm->addRootEntityFromClassMetadata($className, 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(BooleanModel::class, 'c');
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$entity = new BooleanModel();
|
||||
|
@ -2,15 +2,15 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Cache;
|
||||
|
||||
use Doctrine\ORM\Cache\CacheKey;
|
||||
use Doctrine\ORM\Cache\ConcurrentRegion;
|
||||
use Doctrine\ORM\Cache\Lock;
|
||||
use Doctrine\ORM\Cache\Region\DefaultRegion;
|
||||
use Doctrine\ORM\Cache\Region\FileLockRegion;
|
||||
use Doctrine\ORM\Cache\ConcurrentRegion;
|
||||
use Doctrine\Tests\Mocks\CacheEntryMock;
|
||||
use Doctrine\Tests\Mocks\CacheKeyMock;
|
||||
use Doctrine\ORM\Cache\CacheKey;
|
||||
|
||||
use RecursiveIteratorIterator;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
|
||||
/**
|
||||
* @group DDC-2183
|
||||
@ -77,7 +77,7 @@ class FileLockRegionTest extends AbstractRegionTest
|
||||
$lock = $this->region->lock($key);
|
||||
|
||||
$this->assertFileExists($file);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Lock', $lock);
|
||||
$this->assertInstanceOf(Lock::class, $lock);
|
||||
$this->assertEquals($lock->value, file_get_contents($file));
|
||||
|
||||
// should be not available after lock
|
||||
@ -121,7 +121,7 @@ class FileLockRegionTest extends AbstractRegionTest
|
||||
$this->assertTrue($this->region->put($key, $entry));
|
||||
$this->assertTrue($this->region->contains($key));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Lock', $lock = $this->region->lock($key));
|
||||
$this->assertInstanceOf(Lock::class, $lock = $this->region->lock($key));
|
||||
$this->assertEquals($lock->value, file_get_contents($file));
|
||||
$this->assertFileExists($file);
|
||||
|
||||
@ -173,7 +173,7 @@ class FileLockRegionTest extends AbstractRegionTest
|
||||
$this->assertTrue($this->region->put($key, $entry));
|
||||
$this->assertTrue($this->region->contains($key));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Lock', $lock = $this->region->lock($key));
|
||||
$this->assertInstanceOf(Lock::class, $lock = $this->region->lock($key));
|
||||
$this->assertEquals($lock->value, file_get_contents($file));
|
||||
$this->assertFileExists($file);
|
||||
|
||||
@ -201,8 +201,8 @@ class FileLockRegionTest extends AbstractRegionTest
|
||||
$this->assertTrue($this->region->put($key2, $entry2));
|
||||
$this->assertTrue($this->region->contains($key2));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Lock', $lock1 = $this->region->lock($key1));
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Lock', $lock2 = $this->region->lock($key2));
|
||||
$this->assertInstanceOf(Lock::class, $lock1 = $this->region->lock($key1));
|
||||
$this->assertInstanceOf(Lock::class, $lock2 = $this->region->lock($key2));
|
||||
|
||||
$this->assertEquals($lock2->value, file_get_contents($file2));
|
||||
$this->assertEquals($lock1->value, file_get_contents($file1));
|
||||
@ -233,7 +233,7 @@ class FileLockRegionTest extends AbstractRegionTest
|
||||
$this->assertTrue($this->region->put($key, $entry));
|
||||
$this->assertTrue($this->region->contains($key));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Lock', $lock = $this->region->lock($key));
|
||||
$this->assertInstanceOf(Lock::class, $lock = $this->region->lock($key));
|
||||
$this->assertEquals($lock->value, file_get_contents($file));
|
||||
$this->assertFileExists($file);
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Cache\Persister\Collection;
|
||||
|
||||
use Doctrine\ORM\Cache\Persister\CachedPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
|
||||
@ -101,7 +103,7 @@ abstract class AbstractCollectionPersisterTest extends OrmTestCase
|
||||
protected function createCollection($owner, $assoc = null, $class = null, $elements = null)
|
||||
{
|
||||
$em = $this->em;
|
||||
$class = $class ?: $this->em->getClassMetadata('Doctrine\Tests\Models\Cache\State');
|
||||
$class = $class ?: $this->em->getClassMetadata(State::class);
|
||||
$assoc = $assoc ?: $class->associationMappings['cities'];
|
||||
$coll = new PersistentCollection($em, $class, $elements ?: new ArrayCollection);
|
||||
|
||||
@ -113,7 +115,7 @@ abstract class AbstractCollectionPersisterTest extends OrmTestCase
|
||||
|
||||
protected function createPersisterDefault()
|
||||
{
|
||||
$assoc = $this->em->getClassMetadata('Doctrine\Tests\Models\Cache\State')->associationMappings['cities'];
|
||||
$assoc = $this->em->getClassMetadata(State::class)->associationMappings['cities'];
|
||||
|
||||
return $this->createPersister($this->em, $this->collectionPersister, $this->region, $assoc);
|
||||
}
|
||||
@ -122,9 +124,9 @@ abstract class AbstractCollectionPersisterTest extends OrmTestCase
|
||||
{
|
||||
$persister = $this->createPersisterDefault();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Persisters\Collection\CollectionPersister', $persister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\CachedPersister', $persister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister', $persister);
|
||||
$this->assertInstanceOf(CollectionPersister::class, $persister);
|
||||
$this->assertInstanceOf(CachedPersister::class, $persister);
|
||||
$this->assertInstanceOf(CachedCollectionPersister::class, $persister);
|
||||
}
|
||||
|
||||
public function testInvokeDelete()
|
||||
|
@ -52,7 +52,7 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
|
||||
$this->region->expects($this->once())
|
||||
->method('lock')
|
||||
@ -70,7 +70,7 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
|
||||
$this->region->expects($this->once())
|
||||
->method('lock')
|
||||
@ -88,7 +88,7 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
|
||||
$this->region->expects($this->once())
|
||||
->method('lock')
|
||||
@ -112,7 +112,7 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
|
||||
$this->region->expects($this->once())
|
||||
->method('lock')
|
||||
@ -135,8 +135,8 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister', 'queuedCache');
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedCollectionPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
@ -166,8 +166,8 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister', 'queuedCache');
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedCollectionPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
@ -197,8 +197,8 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister', 'queuedCache');
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedCollectionPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
@ -228,8 +228,8 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister', 'queuedCache');
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedCollectionPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
@ -258,8 +258,8 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$entity = new State("Foo");
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister', 'queuedCache');
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedCollectionPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
@ -283,8 +283,8 @@ class ReadWriteCachedCollectionPersisterTest extends AbstractCollectionPersister
|
||||
$entity = new State("Foo");
|
||||
$persister = $this->createPersisterDefault();
|
||||
$collection = $this->createCollection($entity);
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Collection\ReadWriteCachedCollectionPersister', 'queuedCache');
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedCollectionPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
|
@ -2,18 +2,18 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Cache\Persister\Entity;
|
||||
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\Cache\Persister\CachedPersister;
|
||||
use Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister;
|
||||
use Doctrine\ORM\Cache\Region;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Persisters\Entity\EntityPersister;
|
||||
|
||||
use Doctrine\Tests\Models\Cache\Country;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\ORM\Persisters\Entity\EntityPersister;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Doctrine\Tests\Models\Cache\Country;
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
|
||||
/**
|
||||
* @group DDC-2183
|
||||
@ -119,16 +119,16 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
|
||||
*/
|
||||
protected function createPersisterDefault()
|
||||
{
|
||||
return $this->createPersister($this->em, $this->entityPersister, $this->region, $this->em->getClassMetadata('Doctrine\Tests\Models\Cache\Country'));
|
||||
return $this->createPersister($this->em, $this->entityPersister, $this->region, $this->em->getClassMetadata(Country::class));
|
||||
}
|
||||
|
||||
public function testImplementsEntityPersister()
|
||||
{
|
||||
$persister = $this->createPersisterDefault();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Persisters\Entity\EntityPersister', $persister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\CachedPersister', $persister);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister', $persister);
|
||||
$this->assertInstanceOf(EntityPersister::class, $persister);
|
||||
$this->assertInstanceOf(CachedPersister::class, $persister);
|
||||
$this->assertInstanceOf(CachedEntityPersister::class, $persister);
|
||||
}
|
||||
|
||||
public function testInvokeAddInsert()
|
||||
@ -293,7 +293,7 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
|
||||
$persister = $this->createPersisterDefault();
|
||||
$entity = new Country("Foo");
|
||||
|
||||
$rsm->addEntityResult(Country::CLASSNAME, 'c');
|
||||
$rsm->addEntityResult(Country::class, 'c');
|
||||
|
||||
$this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']);
|
||||
|
||||
@ -356,7 +356,7 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
|
||||
$criteria = new Criteria();
|
||||
|
||||
$this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']);
|
||||
$rsm->addEntityResult(Country::CLASSNAME, 'c');
|
||||
$rsm->addEntityResult(Country::class, 'c');
|
||||
|
||||
$this->entityPersister->expects($this->once())
|
||||
->method('getResultSetMapping')
|
||||
@ -398,7 +398,7 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
|
||||
|
||||
public function testInvokeLoadManyToManyCollection()
|
||||
{
|
||||
$mapping = $this->em->getClassMetadata('Doctrine\Tests\Models\Cache\Country');
|
||||
$mapping = $this->em->getClassMetadata(Country::class);
|
||||
$assoc = ['type' => 1];
|
||||
$coll = new PersistentCollection($this->em, $mapping, new ArrayCollection());
|
||||
$persister = $this->createPersisterDefault();
|
||||
@ -414,7 +414,7 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
|
||||
|
||||
public function testInvokeLoadOneToManyCollection()
|
||||
{
|
||||
$mapping = $this->em->getClassMetadata('Doctrine\Tests\Models\Cache\Country');
|
||||
$mapping = $this->em->getClassMetadata(Country::class);
|
||||
$assoc = ['type' => 1];
|
||||
$coll = new PersistentCollection($this->em, $mapping, new ArrayCollection());
|
||||
$persister = $this->createPersisterDefault();
|
||||
|
@ -48,8 +48,8 @@ class NonStrictReadWriteCachedEntityPersisterTest extends AbstractEntityPersiste
|
||||
{
|
||||
$entity = new Country("Foo");
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$entry = new EntityCacheEntry(Country::CLASSNAME, ['id'=>1, 'name'=>'Foo']);
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
$entry = new EntityCacheEntry(Country::class, ['id'=>1, 'name'=>'Foo']);
|
||||
$property = new \ReflectionProperty($persister, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
@ -85,8 +85,8 @@ class NonStrictReadWriteCachedEntityPersisterTest extends AbstractEntityPersiste
|
||||
{
|
||||
$entity = new Country("Foo");
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$entry = new EntityCacheEntry(Country::CLASSNAME, ['id'=>1, 'name'=>'Foo']);
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
$entry = new EntityCacheEntry(Country::class, ['id'=>1, 'name'=>'Foo']);
|
||||
$property = new \ReflectionProperty($persister, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
@ -114,7 +114,7 @@ class NonStrictReadWriteCachedEntityPersisterTest extends AbstractEntityPersiste
|
||||
{
|
||||
$entity = new Country("Foo");
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
$property = new \ReflectionProperty($persister, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
@ -52,7 +52,7 @@ class ReadWriteCachedEntityPersisterTest extends AbstractEntityPersisterTest
|
||||
$entity = new Country("Foo");
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
|
||||
$this->region->expects($this->once())
|
||||
->method('lock')
|
||||
@ -69,7 +69,7 @@ class ReadWriteCachedEntityPersisterTest extends AbstractEntityPersisterTest
|
||||
$entity = new Country("Foo");
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
|
||||
$this->region->expects($this->once())
|
||||
->method('lock')
|
||||
@ -86,7 +86,7 @@ class ReadWriteCachedEntityPersisterTest extends AbstractEntityPersisterTest
|
||||
$entity = new Country("Foo");
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
|
||||
$this->region->expects($this->once())
|
||||
->method('lock')
|
||||
@ -109,7 +109,7 @@ class ReadWriteCachedEntityPersisterTest extends AbstractEntityPersisterTest
|
||||
$entity = new Country("Foo");
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
|
||||
$this->region->expects($this->once())
|
||||
->method('lock')
|
||||
@ -131,8 +131,8 @@ class ReadWriteCachedEntityPersisterTest extends AbstractEntityPersisterTest
|
||||
$entity = new Country("Foo");
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Entity\ReadWriteCachedEntityPersister', 'queuedCache');
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedEntityPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
@ -162,8 +162,8 @@ class ReadWriteCachedEntityPersisterTest extends AbstractEntityPersisterTest
|
||||
$entity = new Country("Foo");
|
||||
$lock = Lock::createLockRead();
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Entity\ReadWriteCachedEntityPersister', 'queuedCache');
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedEntityPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
@ -192,8 +192,8 @@ class ReadWriteCachedEntityPersisterTest extends AbstractEntityPersisterTest
|
||||
{
|
||||
$entity = new Country("Foo");
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Entity\ReadWriteCachedEntityPersister', 'queuedCache');
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedEntityPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
@ -216,8 +216,8 @@ class ReadWriteCachedEntityPersisterTest extends AbstractEntityPersisterTest
|
||||
{
|
||||
$entity = new Country("Foo");
|
||||
$persister = $this->createPersisterDefault();
|
||||
$key = new EntityCacheKey(Country::CLASSNAME, ['id'=>1]);
|
||||
$property = new \ReflectionProperty('Doctrine\ORM\Cache\Persister\Entity\ReadWriteCachedEntityPersister', 'queuedCache');
|
||||
$key = new EntityCacheKey(Country::class, ['id'=>1]);
|
||||
$property = new \ReflectionProperty(ReadWriteCachedEntityPersister::class, 'queuedCache');
|
||||
|
||||
$property->setAccessible(true);
|
||||
|
||||
|
@ -29,7 +29,7 @@ class StatisticsCacheLoggerTest extends DoctrineTestCase
|
||||
public function testEntityCache()
|
||||
{
|
||||
$name = 'my_entity_region';
|
||||
$key = new EntityCacheKey(State::CLASSNAME, ['id' => 1]);
|
||||
$key = new EntityCacheKey(State::class, ['id' => 1]);
|
||||
|
||||
$this->logger->entityCacheHit($name, $key);
|
||||
$this->logger->entityCachePut($name, $key);
|
||||
@ -46,7 +46,7 @@ class StatisticsCacheLoggerTest extends DoctrineTestCase
|
||||
public function testCollectionCache()
|
||||
{
|
||||
$name = 'my_collection_region';
|
||||
$key = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id' => 1]);
|
||||
$key = new CollectionCacheKey(State::class, 'cities', ['id' => 1]);
|
||||
|
||||
$this->logger->collectionCacheHit($name, $key);
|
||||
$this->logger->collectionCachePut($name, $key);
|
||||
@ -83,8 +83,8 @@ class StatisticsCacheLoggerTest extends DoctrineTestCase
|
||||
$entityRegion = 'my_entity_region';
|
||||
$queryRegion = 'my_query_region';
|
||||
|
||||
$coolKey = new CollectionCacheKey(State::CLASSNAME, 'cities', ['id' => 1]);
|
||||
$entityKey = new EntityCacheKey(State::CLASSNAME, ['id' => 1]);
|
||||
$coolKey = new CollectionCacheKey(State::class, 'cities', ['id' => 1]);
|
||||
$entityKey = new EntityCacheKey(State::class, ['id' => 1]);
|
||||
$queryKey = new QueryCacheKey('my_query_hash');
|
||||
|
||||
$this->logger->queryCacheHit($queryRegion, $queryKey);
|
||||
|
@ -24,11 +24,11 @@ class CommitOrderCalculatorTest extends OrmTestCase
|
||||
|
||||
public function testCommitOrdering1()
|
||||
{
|
||||
$class1 = new ClassMetadata(__NAMESPACE__ . '\NodeClass1');
|
||||
$class2 = new ClassMetadata(__NAMESPACE__ . '\NodeClass2');
|
||||
$class3 = new ClassMetadata(__NAMESPACE__ . '\NodeClass3');
|
||||
$class4 = new ClassMetadata(__NAMESPACE__ . '\NodeClass4');
|
||||
$class5 = new ClassMetadata(__NAMESPACE__ . '\NodeClass5');
|
||||
$class1 = new ClassMetadata(NodeClass1::class);
|
||||
$class2 = new ClassMetadata(NodeClass2::class);
|
||||
$class3 = new ClassMetadata(NodeClass3::class);
|
||||
$class4 = new ClassMetadata(NodeClass4::class);
|
||||
$class5 = new ClassMetadata(NodeClass5::class);
|
||||
|
||||
$this->_calc->addNode($class1->name, $class1);
|
||||
$this->_calc->addNode($class2->name, $class2);
|
||||
@ -51,8 +51,8 @@ class CommitOrderCalculatorTest extends OrmTestCase
|
||||
|
||||
public function testCommitOrdering2()
|
||||
{
|
||||
$class1 = new ClassMetadata(__NAMESPACE__ . '\NodeClass1');
|
||||
$class2 = new ClassMetadata(__NAMESPACE__ . '\NodeClass2');
|
||||
$class1 = new ClassMetadata(NodeClass1::class);
|
||||
$class2 = new ClassMetadata(NodeClass2::class);
|
||||
|
||||
$this->_calc->addNode($class1->name, $class1);
|
||||
$this->_calc->addNode($class2->name, $class2);
|
||||
|
@ -7,6 +7,7 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
|
||||
use Doctrine\Common\Proxy\AbstractProxyFactory;
|
||||
use Doctrine\Common\Cache\ArrayCache;
|
||||
use Doctrine\ORM\Cache\CacheConfiguration;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Mapping as AnnotationNamespace;
|
||||
use Doctrine\ORM\Configuration;
|
||||
use Doctrine\ORM\Mapping\EntityListenerResolver;
|
||||
@ -14,6 +15,7 @@ use Doctrine\ORM\Mapping\NamingStrategy;
|
||||
use Doctrine\ORM\Mapping\QuoteStrategy;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\Tests\Models\DDC753\DDC753CustomRepository;
|
||||
use ReflectionClass;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
@ -76,23 +78,23 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
public function testNewDefaultAnnotationDriver()
|
||||
{
|
||||
$paths = [__DIR__];
|
||||
$reflectionClass = new ReflectionClass(__NAMESPACE__ . '\ConfigurationTestAnnotationReaderChecker');
|
||||
$reflectionClass = new ReflectionClass(ConfigurationTestAnnotationReaderChecker::class);
|
||||
|
||||
$annotationDriver = $this->configuration->newDefaultAnnotationDriver($paths, false);
|
||||
$reader = $annotationDriver->getReader();
|
||||
$annotation = $reader->getMethodAnnotation(
|
||||
$reflectionClass->getMethod('namespacedAnnotationMethod'),
|
||||
'Doctrine\ORM\Mapping\PrePersist'
|
||||
AnnotationNamespace\PrePersist::class
|
||||
);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\PrePersist', $annotation);
|
||||
$this->assertInstanceOf(AnnotationNamespace\PrePersist::class, $annotation);
|
||||
|
||||
$annotationDriver = $this->configuration->newDefaultAnnotationDriver($paths);
|
||||
$reader = $annotationDriver->getReader();
|
||||
$annotation = $reader->getMethodAnnotation(
|
||||
$reflectionClass->getMethod('simpleAnnotationMethod'),
|
||||
'Doctrine\ORM\Mapping\PrePersist'
|
||||
AnnotationNamespace\PrePersist::class
|
||||
);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\PrePersist', $annotation);
|
||||
$this->assertInstanceOf(AnnotationNamespace\PrePersist::class, $annotation);
|
||||
}
|
||||
|
||||
public function testSetGetEntityNamespace()
|
||||
@ -102,7 +104,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
$namespaces = ['OtherNamespace' => __NAMESPACE__];
|
||||
$this->configuration->setEntityNamespaces($namespaces);
|
||||
$this->assertSame($namespaces, $this->configuration->getEntityNamespaces());
|
||||
$this->expectException(\Doctrine\ORM\ORMException::class);
|
||||
$this->expectException(ORMException::class);
|
||||
$this->configuration->getEntityNamespace('NonExistingNamespace');
|
||||
}
|
||||
|
||||
@ -135,7 +137,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
$dql = 'SELECT u FROM User u';
|
||||
$this->configuration->addNamedQuery('QueryName', $dql);
|
||||
$this->assertSame($dql, $this->configuration->getNamedQuery('QueryName'));
|
||||
$this->expectException(\Doctrine\ORM\ORMException::class);
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage('a named query');
|
||||
$this->configuration->getNamedQuery('NonExistingQuery');
|
||||
}
|
||||
@ -148,7 +150,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
$fetched = $this->configuration->getNamedNativeQuery('QueryName');
|
||||
$this->assertSame($sql, $fetched[0]);
|
||||
$this->assertSame($rsm, $fetched[1]);
|
||||
$this->expectException(\Doctrine\ORM\ORMException::class);
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage('a named native query');
|
||||
$this->configuration->getNamedNativeQuery('NonExistingQuery');
|
||||
}
|
||||
@ -261,7 +263,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertSame(null, $this->configuration->getCustomStringFunction('NonExistingFunction'));
|
||||
$this->configuration->setCustomStringFunctions(['OtherFunctionName' => __CLASS__]);
|
||||
$this->assertSame(__CLASS__, $this->configuration->getCustomStringFunction('OtherFunctionName'));
|
||||
$this->expectException(\Doctrine\ORM\ORMException::class);
|
||||
$this->expectException(ORMException::class);
|
||||
$this->configuration->addCustomStringFunction('concat', __CLASS__);
|
||||
}
|
||||
|
||||
@ -272,7 +274,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertSame(null, $this->configuration->getCustomNumericFunction('NonExistingFunction'));
|
||||
$this->configuration->setCustomNumericFunctions(['OtherFunctionName' => __CLASS__]);
|
||||
$this->assertSame(__CLASS__, $this->configuration->getCustomNumericFunction('OtherFunctionName'));
|
||||
$this->expectException(\Doctrine\ORM\ORMException::class);
|
||||
$this->expectException(ORMException::class);
|
||||
$this->configuration->addCustomNumericFunction('abs', __CLASS__);
|
||||
}
|
||||
|
||||
@ -283,7 +285,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertSame(null, $this->configuration->getCustomDatetimeFunction('NonExistingFunction'));
|
||||
$this->configuration->setCustomDatetimeFunctions(['OtherFunctionName' => __CLASS__]);
|
||||
$this->assertSame(__CLASS__, $this->configuration->getCustomDatetimeFunction('OtherFunctionName'));
|
||||
$this->expectException(\Doctrine\ORM\ORMException::class);
|
||||
$this->expectException(ORMException::class);
|
||||
$this->configuration->addCustomDatetimeFunction('date_add', __CLASS__);
|
||||
}
|
||||
|
||||
@ -311,7 +313,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSetGetClassMetadataFactoryName()
|
||||
{
|
||||
$this->assertSame('Doctrine\ORM\Mapping\ClassMetadataFactory', $this->configuration->getClassMetadataFactoryName());
|
||||
$this->assertSame(AnnotationNamespace\ClassMetadataFactory::class, $this->configuration->getClassMetadataFactoryName());
|
||||
$this->configuration->setClassMetadataFactoryName(__CLASS__);
|
||||
$this->assertSame(__CLASS__, $this->configuration->getClassMetadataFactoryName());
|
||||
}
|
||||
@ -325,17 +327,16 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function setDefaultRepositoryClassName()
|
||||
{
|
||||
$this->assertSame('Doctrine\ORM\EntityRepository', $this->configuration->getDefaultRepositoryClassName());
|
||||
$repositoryClass = 'Doctrine\Tests\Models\DDC753\DDC753CustomRepository';
|
||||
$this->configuration->setDefaultRepositoryClassName($repositoryClass);
|
||||
$this->assertSame($repositoryClass, $this->configuration->getDefaultRepositoryClassName());
|
||||
$this->expectException(\Doctrine\ORM\ORMException::class);
|
||||
$this->assertSame(EntityRepository::class, $this->configuration->getDefaultRepositoryClassName());
|
||||
$this->configuration->setDefaultRepositoryClassName(DDC753CustomRepository::class);
|
||||
$this->assertSame(DDC753CustomRepository::class, $this->configuration->getDefaultRepositoryClassName());
|
||||
$this->expectException(ORMException::class);
|
||||
$this->configuration->setDefaultRepositoryClassName(__CLASS__);
|
||||
}
|
||||
|
||||
public function testSetGetNamingStrategy()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\NamingStrategy', $this->configuration->getNamingStrategy());
|
||||
$this->assertInstanceOf(NamingStrategy::class, $this->configuration->getNamingStrategy());
|
||||
$namingStrategy = $this->createMock(NamingStrategy::class);
|
||||
$this->configuration->setNamingStrategy($namingStrategy);
|
||||
$this->assertSame($namingStrategy, $this->configuration->getNamingStrategy());
|
||||
@ -343,7 +344,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSetGetQuoteStrategy()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\QuoteStrategy', $this->configuration->getQuoteStrategy());
|
||||
$this->assertInstanceOf(QuoteStrategy::class, $this->configuration->getQuoteStrategy());
|
||||
$quoteStrategy = $this->createMock(QuoteStrategy::class);
|
||||
$this->configuration->setQuoteStrategy($quoteStrategy);
|
||||
$this->assertSame($quoteStrategy, $this->configuration->getQuoteStrategy());
|
||||
@ -354,8 +355,8 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSetGetEntityListenerResolver()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\EntityListenerResolver', $this->configuration->getEntityListenerResolver());
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\DefaultEntityListenerResolver', $this->configuration->getEntityListenerResolver());
|
||||
$this->assertInstanceOf(EntityListenerResolver::class, $this->configuration->getEntityListenerResolver());
|
||||
$this->assertInstanceOf(AnnotationNamespace\DefaultEntityListenerResolver::class, $this->configuration->getEntityListenerResolver());
|
||||
$resolver = $this->createMock(EntityListenerResolver::class);
|
||||
$this->configuration->setEntityListenerResolver($resolver);
|
||||
$this->assertSame($resolver, $this->configuration->getEntityListenerResolver());
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Decorator;
|
||||
|
||||
use Doctrine\ORM\Decorator\EntityManagerDecorator;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
|
||||
@ -13,7 +15,7 @@ class EntityManagerDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
public function setUp()
|
||||
{
|
||||
$this->wrapped = $this->createMock(EntityManagerInterface::class);
|
||||
$this->decorator = $this->getMockBuilder('Doctrine\ORM\Decorator\EntityManagerDecorator')
|
||||
$this->decorator = $this->getMockBuilder(EntityManagerDecorator::class)
|
||||
->setConstructorArgs([$this->wrapped])
|
||||
->setMethods(null)
|
||||
->getMock();
|
||||
@ -21,7 +23,7 @@ class EntityManagerDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function getMethodParameters()
|
||||
{
|
||||
$class = new \ReflectionClass('Doctrine\ORM\EntityManager');
|
||||
$class = new \ReflectionClass(EntityManager::class);
|
||||
|
||||
$methods = [];
|
||||
foreach ($class->getMethods() as $method) {
|
||||
|
@ -2,13 +2,22 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
|
||||
use Doctrine\Common\Persistence\Mapping\MappingException;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\ORM\Configuration;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataFactory;
|
||||
use Doctrine\ORM\NativeQuery;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
use Doctrine\ORM\Proxy\ProxyFactory;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\GeoNames\Country;
|
||||
use Doctrine\Tests\OrmTestCase;
|
||||
|
||||
@ -37,32 +46,32 @@ class EntityManagerTest extends OrmTestCase
|
||||
|
||||
public function testGetConnection()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\DBAL\Connection', $this->_em->getConnection());
|
||||
$this->assertInstanceOf(Connection::class, $this->_em->getConnection());
|
||||
}
|
||||
|
||||
public function testGetMetadataFactory()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Mapping\ClassMetadataFactory', $this->_em->getMetadataFactory());
|
||||
$this->assertInstanceOf(ClassMetadataFactory::class, $this->_em->getMetadataFactory());
|
||||
}
|
||||
|
||||
public function testGetConfiguration()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Configuration', $this->_em->getConfiguration());
|
||||
$this->assertInstanceOf(Configuration::class, $this->_em->getConfiguration());
|
||||
}
|
||||
|
||||
public function testGetUnitOfWork()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\UnitOfWork', $this->_em->getUnitOfWork());
|
||||
$this->assertInstanceOf(UnitOfWork::class, $this->_em->getUnitOfWork());
|
||||
}
|
||||
|
||||
public function testGetProxyFactory()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\ProxyFactory', $this->_em->getProxyFactory());
|
||||
$this->assertInstanceOf(ProxyFactory::class, $this->_em->getProxyFactory());
|
||||
}
|
||||
|
||||
public function testGetEventManager()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\Common\EventManager', $this->_em->getEventManager());
|
||||
$this->assertInstanceOf(EventManager::class, $this->_em->getEventManager());
|
||||
}
|
||||
|
||||
public function testCreateNativeQuery()
|
||||
@ -83,18 +92,18 @@ class EntityManagerTest extends OrmTestCase
|
||||
|
||||
$query = $this->_em->createNamedNativeQuery('foo');
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\NativeQuery', $query);
|
||||
$this->assertInstanceOf(NativeQuery::class, $query);
|
||||
}
|
||||
|
||||
public function testCreateQueryBuilder()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\QueryBuilder', $this->_em->createQueryBuilder());
|
||||
$this->assertInstanceOf(QueryBuilder::class, $this->_em->createQueryBuilder());
|
||||
}
|
||||
|
||||
public function testCreateQueryBuilderAliasValid()
|
||||
{
|
||||
$q = $this->_em->createQueryBuilder()
|
||||
->select('u')->from('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
->select('u')->from(CmsUser::class, 'u');
|
||||
$q2 = clone $q;
|
||||
|
||||
$this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $q->getQuery()->getDql());
|
||||
@ -107,12 +116,12 @@ class EntityManagerTest extends OrmTestCase
|
||||
|
||||
public function testCreateQuery_DqlIsOptional()
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\ORM\Query', $this->_em->createQuery());
|
||||
$this->assertInstanceOf(Query::class, $this->_em->createQuery());
|
||||
}
|
||||
|
||||
public function testGetPartialReference()
|
||||
{
|
||||
$user = $this->_em->getPartialReference('Doctrine\Tests\Models\CMS\CmsUser', 42);
|
||||
$user = $this->_em->getPartialReference(CmsUser::class, 42);
|
||||
$this->assertTrue($this->_em->contains($user));
|
||||
$this->assertEquals(42, $user->id);
|
||||
$this->assertNull($user->getName());
|
||||
@ -121,7 +130,7 @@ class EntityManagerTest extends OrmTestCase
|
||||
public function testCreateQuery()
|
||||
{
|
||||
$q = $this->_em->createQuery('SELECT 1');
|
||||
$this->assertInstanceOf('Doctrine\ORM\Query', $q);
|
||||
$this->assertInstanceOf(Query::class, $q);
|
||||
$this->assertEquals('SELECT 1', $q->getDql());
|
||||
}
|
||||
|
||||
@ -133,7 +142,7 @@ class EntityManagerTest extends OrmTestCase
|
||||
$this->_em->getConfiguration()->addNamedQuery('foo', 'SELECT 1');
|
||||
|
||||
$query = $this->_em->createNamedQuery('foo');
|
||||
$this->assertInstanceOf('Doctrine\ORM\Query', $query);
|
||||
$this->assertInstanceOf(Query::class, $query);
|
||||
$this->assertEquals('SELECT 1', $query->getDql());
|
||||
}
|
||||
|
||||
|
@ -3,14 +3,13 @@
|
||||
namespace Doctrine\Tests\ORM;
|
||||
|
||||
use Doctrine\ORM\EntityNotFoundException;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
/**
|
||||
* Tests for {@see \Doctrine\ORM\EntityNotFoundException}
|
||||
*
|
||||
* @covers \Doctrine\ORM\EntityNotFoundException
|
||||
*/
|
||||
class EntityNotFoundExceptionTest extends PHPUnit_Framework_TestCase
|
||||
class EntityNotFoundExceptionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testFromClassNameAndIdentifier()
|
||||
{
|
||||
@ -19,7 +18,7 @@ class EntityNotFoundExceptionTest extends PHPUnit_Framework_TestCase
|
||||
['foo' => 'bar']
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\EntityNotFoundException', $exception);
|
||||
$this->assertInstanceOf(EntityNotFoundException::class, $exception);
|
||||
$this->assertSame('Entity of type \'foo\' for IDs foo(bar) was not found', $exception->getMessage());
|
||||
|
||||
$exception = EntityNotFoundException::fromClassNameAndIdentifier(
|
||||
@ -27,7 +26,7 @@ class EntityNotFoundExceptionTest extends PHPUnit_Framework_TestCase
|
||||
[]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\EntityNotFoundException', $exception);
|
||||
$this->assertInstanceOf(EntityNotFoundException::class, $exception);
|
||||
$this->assertSame('Entity of type \'foo\' was not found', $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -18,11 +18,11 @@ class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Phrase'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\PhraseType'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Definition'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Lemma'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Type')
|
||||
$this->_em->getClassMetadata(Phrase::class),
|
||||
$this->_em->getClassMetadata(PhraseType::class),
|
||||
$this->_em->getClassMetadata(Definition::class),
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Type::class)
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -57,7 +57,7 @@ class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
//end setup
|
||||
|
||||
// test1 - lazy-loading many-to-one after find()
|
||||
$phrase2 = $this->_em->find('Doctrine\Tests\ORM\Functional\Phrase', $phrase->getId());
|
||||
$phrase2 = $this->_em->find(Phrase::class, $phrase->getId());
|
||||
$this->assertTrue(is_numeric($phrase2->getType()->getId()));
|
||||
|
||||
$this->_em->clear();
|
||||
@ -66,8 +66,8 @@ class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
$query = $this->_em->createQuery("SELECT p,t FROM Doctrine\Tests\ORM\Functional\Phrase p JOIN p.type t");
|
||||
$res = $query->getResult();
|
||||
$this->assertEquals(1, count($res));
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\PhraseType', $res[0]->getType());
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $res[0]->getType()->getPhrases());
|
||||
$this->assertInstanceOf(PhraseType::class, $res[0]->getType());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $res[0]->getType()->getPhrases());
|
||||
$this->assertFalse($res[0]->getType()->getPhrases()->isInitialized());
|
||||
|
||||
$this->_em->clear();
|
||||
@ -76,17 +76,17 @@ class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
$query = $this->_em->createQuery("SELECT p,t,pp FROM Doctrine\Tests\ORM\Functional\Phrase p JOIN p.type t JOIN t.phrases pp");
|
||||
$res = $query->getResult();
|
||||
$this->assertEquals(1, count($res));
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\PhraseType', $res[0]->getType());
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $res[0]->getType()->getPhrases());
|
||||
$this->assertInstanceOf(PhraseType::class, $res[0]->getType());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $res[0]->getType()->getPhrases());
|
||||
$this->assertTrue($res[0]->getType()->getPhrases()->isInitialized());
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
// test3 - lazy-loading one-to-many after find()
|
||||
$phrase3 = $this->_em->find('Doctrine\Tests\ORM\Functional\Phrase', $phrase->getId());
|
||||
$phrase3 = $this->_em->find(Phrase::class, $phrase->getId());
|
||||
$definitions = $phrase3->getDefinitions();
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $definitions);
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Definition', $definitions[0]);
|
||||
$this->assertInstanceOf(PersistentCollection::class, $definitions);
|
||||
$this->assertInstanceOf(Definition::class, $definitions[0]);
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
@ -97,7 +97,7 @@ class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertEquals(1, count($res));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Definition', $definitions[0]);
|
||||
$this->assertInstanceOf(Definition::class, $definitions[0]);
|
||||
$this->assertEquals(2, $definitions->count());
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
$res = $query->getResult();
|
||||
$types = $res[0]->getTypes();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\Type', $types[0]);
|
||||
$this->assertInstanceOf(Type::class, $types[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,13 +6,15 @@ use Doctrine\DBAL\Logging\DebugStack;
|
||||
use Doctrine\ORM\EntityNotFoundException;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\ORMInvalidArgumentException;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
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\Tests\Models\CMS\CmsComment;
|
||||
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
@ -38,7 +40,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$this->assertTrue($this->_em->contains($user));
|
||||
|
||||
// Read
|
||||
$user2 = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $user->id);
|
||||
$user2 = $this->_em->find(CmsUser::class, $user->id);
|
||||
$this->assertTrue($user === $user2);
|
||||
|
||||
// Add a phonenumber
|
||||
@ -138,8 +140,8 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
->getSingleResult();
|
||||
|
||||
// Address has been eager-loaded because it cant be lazy
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $user2->address);
|
||||
$this->assertInstanceOf(CmsAddress::class, $user2->address);
|
||||
$this->assertNotInstanceOf(Proxy::class, $user2->address);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,7 +175,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertEquals(UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW");
|
||||
|
||||
$this->assertNull($this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $id));
|
||||
$this->assertNull($this->_em->find(CmsUser::class, $id));
|
||||
}
|
||||
|
||||
public function testOneToManyOrphanRemoval()
|
||||
@ -278,7 +280,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$this->assertEquals('Guilherme', $users[0]->name);
|
||||
$this->assertEquals('gblanco', $users[0]->username);
|
||||
$this->assertEquals('developer', $users[0]->status);
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->phonenumbers);
|
||||
$this->assertInstanceOf(PersistentCollection::class, $users[0]->phonenumbers);
|
||||
$this->assertTrue($users[0]->phonenumbers->isInitialized());
|
||||
$this->assertEquals(0, $users[0]->phonenumbers->count());
|
||||
//$this->assertNull($users[0]->articles);
|
||||
@ -395,7 +397,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$userId = $user->id;
|
||||
$user = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $user->id);
|
||||
$user = $this->_em->getReference(CmsUser::class, $user->id);
|
||||
|
||||
$dql = "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1";
|
||||
$user = $this->_em->createQuery($dql)
|
||||
@ -508,7 +510,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
|
||||
// Assume we only got the identifier of the address and now want to attach
|
||||
// that address to the user without actually loading it, using getReference().
|
||||
$addressRef = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsAddress', $address->getId());
|
||||
$addressRef = $this->_em->getReference(CmsAddress::class, $address->getId());
|
||||
|
||||
//$addressRef->getId();
|
||||
//\Doctrine\Common\Util\Debug::dump($addressRef);
|
||||
@ -522,8 +524,8 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$query = $this->_em->createQuery("select u, a from Doctrine\Tests\Models\CMS\CmsUser u join u.address a where u.username='gblanco'");
|
||||
$gblanco = $query->getSingleResult();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $gblanco);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $gblanco->getAddress());
|
||||
$this->assertInstanceOf(CmsUser::class, $gblanco);
|
||||
$this->assertInstanceOf(CmsAddress::class, $gblanco->getAddress());
|
||||
$this->assertEquals('Berlin', $gblanco->getAddress()->getCity());
|
||||
|
||||
}
|
||||
@ -594,7 +596,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$articleNew = $this->_em->find('Doctrine\Tests\Models\CMS\CmsArticle', $articleId);
|
||||
$articleNew = $this->_em->find(CmsArticle::class, $articleId);
|
||||
$this->assertEquals("Lorem ipsum dolor sunt. And stuff!", $articleNew->text);
|
||||
$this->assertTrue($this->_em->contains($articleNew));
|
||||
}
|
||||
@ -631,7 +633,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$user2 = $query->getSingleResult();
|
||||
|
||||
$this->assertEquals(1, count($user2->articles));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address);
|
||||
$this->assertInstanceOf(CmsAddress::class, $user2->address);
|
||||
|
||||
$oldLogger = $this->_em->getConnection()->getConfiguration()->getSQLLogger();
|
||||
$debugStack = new DebugStack();
|
||||
@ -656,7 +658,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$userRef = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $user->getId());
|
||||
$userRef = $this->_em->getReference(CmsUser::class, $user->getId());
|
||||
$this->_em->remove($userRef);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
@ -687,12 +689,12 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
|
||||
$userRef = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $user->getId());
|
||||
$userRef = $this->_em->getReference(CmsUser::class, $user->getId());
|
||||
$address2 = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsAddress a where a.user = :user')
|
||||
->setParameter('user', $userRef)
|
||||
->getSingleResult();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $address2->getUser());
|
||||
$this->assertInstanceOf(Proxy::class, $address2->getUser());
|
||||
$this->assertTrue($userRef === $address2->getUser());
|
||||
$this->assertFalse($userRef->__isInitialized__);
|
||||
$this->assertEquals('Germany', $address2->country);
|
||||
@ -872,7 +874,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$userId = $user->id;
|
||||
$this->_em->clear();
|
||||
|
||||
$user = $this->_em->getPartialReference('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
$user = $this->_em->getPartialReference(CmsUser::class, $userId);
|
||||
$this->assertTrue($this->_em->contains($user));
|
||||
$this->assertNull($user->getName());
|
||||
$this->assertEquals($userId, $user->id);
|
||||
@ -904,7 +906,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$user2 = $this->_em->find(get_class($managedUser), $userId);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $user2);
|
||||
$this->assertInstanceOf(CmsUser::class, $user2);
|
||||
}
|
||||
|
||||
public function testMergeNonPersistedProperties()
|
||||
@ -1001,9 +1003,9 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
$dql = "SELECT a FROM Doctrine\Tests\Models\CMS\CmsArticle a WHERE a.id = ?1";
|
||||
$article = $this->_em->createQuery($dql)
|
||||
->setParameter(1, $article->id)
|
||||
->setFetchMode('Doctrine\Tests\Models\CMS\CmsArticle', 'user', ClassMetadata::FETCH_EAGER)
|
||||
->setFetchMode(CmsArticle::class, 'user', ClassMetadata::FETCH_EAGER)
|
||||
->getSingleResult();
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $article->user, "It IS a proxy, ...");
|
||||
$this->assertInstanceOf(Proxy::class, $article->user, "It IS a proxy, ...");
|
||||
$this->assertTrue($article->user->__isInitialized__, "...but its initialized!");
|
||||
$this->assertEquals($qc+2, $this->getCurrentQueryCount());
|
||||
}
|
||||
@ -1045,7 +1047,7 @@ class BasicFunctionalTest extends OrmFunctionalTestCase
|
||||
|
||||
$unitOfWork = $this->_em->getUnitOfWork();
|
||||
|
||||
$this->_em->clear('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$this->_em->clear(CmsUser::class);
|
||||
|
||||
$this->assertEquals(UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($user));
|
||||
$this->assertEquals(UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($article1));
|
||||
|
@ -16,8 +16,8 @@ class CascadeRemoveOrderTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\CascadeRemoveOrderEntityO'),
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\CascadeRemoveOrderEntityG'),
|
||||
$this->_em->getClassMetadata(CascadeRemoveOrderEntityO::class),
|
||||
$this->_em->getClassMetadata(CascadeRemoveOrderEntityG::class),
|
||||
]
|
||||
);
|
||||
}
|
||||
@ -28,8 +28,8 @@ class CascadeRemoveOrderTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_schemaTool->dropSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\CascadeRemoveOrderEntityO'),
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\CascadeRemoveOrderEntityG'),
|
||||
$this->_em->getClassMetadata(CascadeRemoveOrderEntityO::class),
|
||||
$this->_em->getClassMetadata(CascadeRemoveOrderEntityG::class),
|
||||
]
|
||||
);
|
||||
}
|
||||
@ -43,7 +43,7 @@ class CascadeRemoveOrderTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$eOloaded = $this->_em->find('Doctrine\Tests\ORM\Functional\CascadeRemoveOrderEntityO', $eO->getId());
|
||||
$eOloaded = $this->_em->find(CascadeRemoveOrderEntityO::class, $eO->getId());
|
||||
|
||||
$this->_em->remove($eOloaded);
|
||||
$this->_em->flush();
|
||||
@ -62,7 +62,7 @@ class CascadeRemoveOrderTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$eOloaded = $this->_em->find('Doctrine\Tests\ORM\Functional\CascadeRemoveOrderEntityO', $eO->getId());
|
||||
$eOloaded = $this->_em->find(CascadeRemoveOrderEntityO::class, $eO->getId());
|
||||
|
||||
$this->_em->remove($eOloaded);
|
||||
$this->_em->flush();
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\Models\Company\CompanyPerson,
|
||||
Doctrine\Tests\Models\Company\CompanyEmployee,
|
||||
Doctrine\Tests\Models\Company\CompanyManager,
|
||||
@ -50,8 +52,8 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$entities = $query->getResult();
|
||||
|
||||
$this->assertEquals(2, count($entities));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $entities[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $entities[1]);
|
||||
$this->assertInstanceOf(CompanyPerson::class, $entities[0]);
|
||||
$this->assertInstanceOf(CompanyEmployee::class, $entities[1]);
|
||||
$this->assertTrue(is_numeric($entities[0]->getId()));
|
||||
$this->assertTrue(is_numeric($entities[1]->getId()));
|
||||
$this->assertEquals('Roman S. Borschel', $entities[0]->getName());
|
||||
@ -65,7 +67,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$entities = $query->getResult();
|
||||
|
||||
$this->assertEquals(1, count($entities));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $entities[0]);
|
||||
$this->assertInstanceOf(CompanyEmployee::class, $entities[0]);
|
||||
$this->assertTrue(is_numeric($entities[0]->getId()));
|
||||
$this->assertEquals('Guilherme Blanco', $entities[0]->getName());
|
||||
$this->assertEquals(100000, $entities[0]->getSalary());
|
||||
@ -73,7 +75,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$guilherme = $this->_em->getRepository(get_class($employee))->findOneBy(['name' => 'Guilherme Blanco']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $guilherme);
|
||||
$this->assertInstanceOf(CompanyEmployee::class, $guilherme);
|
||||
$this->assertEquals('Guilherme Blanco', $guilherme->getName());
|
||||
|
||||
$this->_em->clear();
|
||||
@ -108,9 +110,9 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId());
|
||||
$manager = $this->_em->find(CompanyManager::class, $manager->getId());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyManager', $manager);
|
||||
$this->assertInstanceOf(CompanyManager::class, $manager);
|
||||
$this->assertEquals('Roman B.', $manager->getName());
|
||||
$this->assertEquals(119000, $manager->getSalary());
|
||||
$this->assertEquals('CEO', $manager->getTitle());
|
||||
@ -128,9 +130,9 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$person = $this->_em->find('Doctrine\Tests\Models\Company\CompanyPerson', $manager->getId());
|
||||
$person = $this->_em->find(CompanyPerson::class, $manager->getId());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyManager', $person);
|
||||
$this->assertInstanceOf(CompanyManager::class, $person);
|
||||
$this->assertEquals('Roman S. Borschel', $person->getName());
|
||||
$this->assertEquals(100000, $person->getSalary());
|
||||
$this->assertEquals('CTO', $person->getTitle());
|
||||
@ -167,9 +169,9 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
|
||||
$result = $query->getResult();
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $result[0]);
|
||||
$this->assertInstanceOf(CompanyPerson::class, $result[0]);
|
||||
$this->assertEquals('Mary Smith', $result[0]->getName());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $result[0]->getSpouse());
|
||||
$this->assertInstanceOf(CompanyEmployee::class, $result[0]->getSpouse());
|
||||
$this->assertEquals('John Smith', $result[0]->getSpouse()->getName());
|
||||
$this->assertSame($result[0], $result[0]->getSpouse()->getSpouse());
|
||||
}
|
||||
@ -229,20 +231,20 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$result = $q->getResult();
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyOrganization', $result[0]);
|
||||
$this->assertInstanceOf(CompanyOrganization::class, $result[0]);
|
||||
$this->assertNull($result[0]->getMainEvent());
|
||||
|
||||
$events = $result[0]->getEvents();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $events);
|
||||
$this->assertInstanceOf(PersistentCollection::class, $events);
|
||||
$this->assertFalse($events->isInitialized());
|
||||
|
||||
$this->assertEquals(2, count($events));
|
||||
if ($events[0] instanceof CompanyAuction) {
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyRaffle', $events[1]);
|
||||
$this->assertInstanceOf(CompanyRaffle::class, $events[1]);
|
||||
} else {
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyRaffle', $events[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $events[1]);
|
||||
$this->assertInstanceOf(CompanyRaffle::class, $events[0]);
|
||||
$this->assertInstanceOf(CompanyAuction::class, $events[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,7 +265,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
|
||||
$result = $q->getResult();
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $result[0], sprintf("Is of class %s",get_class($result[0])));
|
||||
$this->assertInstanceOf(CompanyAuction::class, $result[0], sprintf("Is of class %s",get_class($result[0])));
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
@ -273,12 +275,12 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$result = $q->getResult();
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyOrganization', $result[0]);
|
||||
$this->assertInstanceOf(CompanyOrganization::class, $result[0]);
|
||||
|
||||
$mainEvent = $result[0]->getMainEvent();
|
||||
// mainEvent should have been loaded because it can't be lazy
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyAuction', $mainEvent);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $mainEvent);
|
||||
$this->assertInstanceOf(CompanyAuction::class, $mainEvent);
|
||||
$this->assertNotInstanceOf(Proxy::class, $mainEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -388,12 +390,12 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyManager');
|
||||
$repos = $this->_em->getRepository(CompanyManager::class);
|
||||
$pmanager = $repos->findOneBy(['spouse' => $person->getId()]);
|
||||
|
||||
$this->assertEquals($manager->getId(), $pmanager->getId());
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyPerson');
|
||||
$repos = $this->_em->getRepository(CompanyPerson::class);
|
||||
$pmanager = $repos->findOneBy(['spouse' => $person->getId()]);
|
||||
|
||||
$this->assertEquals($manager->getId(), $pmanager->getId());
|
||||
@ -414,14 +416,14 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$ref = $this->_em->getReference('Doctrine\Tests\Models\Company\CompanyPerson', $manager->getId());
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $ref, "Cannot Request a proxy from a class that has subclasses.");
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $ref);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $ref, "Direct fetch of the reference has to load the child class Employee directly.");
|
||||
$ref = $this->_em->getReference(CompanyPerson::class, $manager->getId());
|
||||
$this->assertNotInstanceOf(Proxy::class, $ref, "Cannot Request a proxy from a class that has subclasses.");
|
||||
$this->assertInstanceOf(CompanyPerson::class, $ref);
|
||||
$this->assertInstanceOf(CompanyEmployee::class, $ref, "Direct fetch of the reference has to load the child class Employee directly.");
|
||||
$this->_em->clear();
|
||||
|
||||
$ref = $this->_em->getReference('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId());
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $ref, "A proxy can be generated only if no subclasses exists for the requested reference.");
|
||||
$ref = $this->_em->getReference(CompanyManager::class, $manager->getId());
|
||||
$this->assertInstanceOf(Proxy::class, $ref, "A proxy can be generated only if no subclasses exists for the requested reference.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -445,7 +447,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $manager->getId());
|
||||
$manager = $this->_em->find(CompanyManager::class, $manager->getId());
|
||||
$this->assertEquals(1, count($manager->getFriends()));
|
||||
}
|
||||
|
||||
@ -482,13 +484,13 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$this->_em->persist($manager);
|
||||
$this->_em->flush();
|
||||
|
||||
$repository = $this->_em->getRepository("Doctrine\Tests\Models\Company\CompanyEmployee");
|
||||
$repository = $this->_em->getRepository(CompanyEmployee::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->eq('department', 'IT')
|
||||
));
|
||||
$this->assertEquals(1, count($users));
|
||||
|
||||
$repository = $this->_em->getRepository("Doctrine\Tests\Models\Company\CompanyManager");
|
||||
$repository = $this->_em->getRepository(CompanyManager::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->eq('department', 'IT')
|
||||
));
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -17,10 +18,10 @@ class ClassTableInheritanceTest2 extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\CTIParent'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\CTIChild'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\CTIRelated'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\CTIRelated2')
|
||||
$this->_em->getClassMetadata(CTIParent::class),
|
||||
$this->_em->getClassMetadata(CTIChild::class),
|
||||
$this->_em->getClassMetadata(CTIRelated::class),
|
||||
$this->_em->getClassMetadata(CTIRelated2::class)
|
||||
]
|
||||
);
|
||||
} catch (\Exception $ignored) {
|
||||
@ -44,11 +45,11 @@ class ClassTableInheritanceTest2 extends OrmFunctionalTestCase
|
||||
|
||||
$relatedId = $related->getId();
|
||||
|
||||
$related2 = $this->_em->find('Doctrine\Tests\ORM\Functional\CTIRelated', $relatedId);
|
||||
$related2 = $this->_em->find(CTIRelated::class, $relatedId);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIRelated', $related2);
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIChild', $related2->getCTIParent());
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $related2->getCTIParent());
|
||||
$this->assertInstanceOf(CTIRelated::class, $related2);
|
||||
$this->assertInstanceOf(CTIChild::class, $related2->getCTIParent());
|
||||
$this->assertNotInstanceOf(Proxy::class, $related2->getCTIParent());
|
||||
$this->assertEquals('hello', $related2->getCTIParent()->getData());
|
||||
|
||||
$this->assertSame($related2, $related2->getCTIParent()->getRelated());
|
||||
@ -72,7 +73,7 @@ class ClassTableInheritanceTest2 extends OrmFunctionalTestCase
|
||||
$this->assertFalse($mmrel2->getCTIChildren()->isInitialized());
|
||||
$this->assertEquals(1, count($mmrel2->getCTIChildren()));
|
||||
$this->assertTrue($mmrel2->getCTIChildren()->isInitialized());
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\CTIChild', $mmrel2->getCTIChildren()->get(0));
|
||||
$this->assertInstanceOf(CTIChild::class, $mmrel2->getCTIChildren()->get(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
|
||||
public function putTripAroundEurope()
|
||||
{
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', ['lat' => 100, 'long' => 200]);
|
||||
$poi = $this->_em->find(NavPointOfInterest::class, ['lat' => 100, 'long' => 200]);
|
||||
|
||||
$tour = new NavTour("Trip around Europe");
|
||||
$tour->addPointOfInterest($poi);
|
||||
@ -46,9 +46,9 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->putGermanysBrandenburderTor();
|
||||
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', ['lat' => 100, 'long' => 200]);
|
||||
$poi = $this->_em->find(NavPointOfInterest::class, ['lat' => 100, 'long' => 200]);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Navigation\NavPointOfInterest', $poi);
|
||||
$this->assertInstanceOf(NavPointOfInterest::class, $poi);
|
||||
$this->assertEquals(100, $poi->getLat());
|
||||
$this->assertEquals(200, $poi->getLong());
|
||||
$this->assertEquals('Brandenburger Tor', $poi->getName());
|
||||
@ -61,7 +61,7 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->putGermanysBrandenburderTor();
|
||||
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', ['lat' => 100, 'long' => 200]);
|
||||
$poi = $this->_em->find(NavPointOfInterest::class, ['lat' => 100, 'long' => 200]);
|
||||
$photo = new NavPhotos($poi, "asdf");
|
||||
$this->_em->persist($photo);
|
||||
$this->_em->flush();
|
||||
@ -79,7 +79,7 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->putGermanysBrandenburderTor();
|
||||
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', ['lat' => 100, 'long' => 200]);
|
||||
$poi = $this->_em->find(NavPointOfInterest::class, ['lat' => 100, 'long' => 200]);
|
||||
$photo = new NavPhotos($poi, "asdf");
|
||||
$this->_em->persist($photo);
|
||||
$this->_em->flush();
|
||||
@ -98,7 +98,7 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
$this->putGermanysBrandenburderTor();
|
||||
$tour = $this->putTripAroundEurope();
|
||||
|
||||
$tour = $this->_em->find('Doctrine\Tests\Models\Navigation\NavTour', $tour->getId());
|
||||
$tour = $this->_em->find(NavTour::class, $tour->getId());
|
||||
|
||||
$this->assertEquals(1, count($tour->getPointOfInterests()));
|
||||
}
|
||||
@ -140,7 +140,7 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage('The identifier long is missing for a query of Doctrine\Tests\Models\Navigation\NavPointOfInterest');
|
||||
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', ['key1' => 100]);
|
||||
$poi = $this->_em->find(NavPointOfInterest::class, ['key1' => 100]);
|
||||
}
|
||||
|
||||
public function testUnrecognizedIdentifierFieldsOnGetReference()
|
||||
@ -148,7 +148,7 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage("Unrecognized identifier fields: 'key1'");
|
||||
|
||||
$poi = $this->_em->getReference('Doctrine\Tests\Models\Navigation\NavPointOfInterest', ['lat' => 10, 'long' => 20, 'key1' => 100]
|
||||
$poi = $this->_em->getReference(NavPointOfInterest::class, ['lat' => 10, 'long' => 20, 'key1' => 100]
|
||||
);
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->putGermanysBrandenburderTor();
|
||||
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', ['lat' => 100, 'long' => 200]);
|
||||
$poi = $this->_em->find(NavPointOfInterest::class, ['lat' => 100, 'long' => 200]);
|
||||
$poi->addVisitor(new NavUser("test1"));
|
||||
$poi->addVisitor(new NavUser("test2"));
|
||||
|
||||
@ -170,7 +170,7 @@ class CompositePrimaryKeyTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$poi = $this->_em->find('Doctrine\Tests\Models\Navigation\NavPointOfInterest', ['lat' => 100, 'long' => 200]);
|
||||
$poi = $this->_em->find(NavPointOfInterest::class, ['lat' => 100, 'long' => 200]);
|
||||
$this->assertEquals(0, count($poi->getVisitors()));
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ class CompositePrimaryKeyWithAssociationsTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testFindByAbleToGetCompositeEntitiesWithMixedTypeIdentifiers()
|
||||
{
|
||||
$admin1Repo = $this->_em->getRepository('Doctrine\Tests\Models\GeoNames\Admin1');
|
||||
$admin1NamesRepo = $this->_em->getRepository('Doctrine\Tests\Models\GeoNames\Admin1AlternateName');
|
||||
$admin1Repo = $this->_em->getRepository(Admin1::class);
|
||||
$admin1NamesRepo = $this->_em->getRepository(Admin1AlternateName::class);
|
||||
|
||||
$admin1Rome = $admin1Repo->findOneBy(['country' => 'IT', 'id' => 1]);
|
||||
|
||||
|
@ -14,9 +14,9 @@ class CustomIdObjectTypeTest extends OrmFunctionalTestCase
|
||||
protected function setUp()
|
||||
{
|
||||
if (DBALType::hasType(CustomIdObjectType::NAME)) {
|
||||
DBALType::overrideType(CustomIdObjectType::NAME, CustomIdObjectType::CLASSNAME);
|
||||
DBALType::overrideType(CustomIdObjectType::NAME, CustomIdObjectType::class);
|
||||
} else {
|
||||
DBALType::addType(CustomIdObjectType::NAME, CustomIdObjectType::CLASSNAME);
|
||||
DBALType::addType(CustomIdObjectType::NAME, CustomIdObjectType::class);
|
||||
}
|
||||
|
||||
$this->useModelSet('custom_id_object_type');
|
||||
@ -31,7 +31,7 @@ class CustomIdObjectTypeTest extends OrmFunctionalTestCase
|
||||
$this->_em->persist($parent);
|
||||
$this->_em->flush();
|
||||
|
||||
$result = $this->_em->find(CustomIdObjectTypeParent::CLASSNAME, $parent->id);
|
||||
$result = $this->_em->find(CustomIdObjectTypeParent::class, $parent->id);
|
||||
|
||||
$this->assertSame($parent, $result);
|
||||
}
|
||||
@ -53,7 +53,7 @@ class CustomIdObjectTypeTest extends OrmFunctionalTestCase
|
||||
->_em
|
||||
->createQuery(
|
||||
'SELECT parent, children FROM '
|
||||
. CustomIdObjectTypeParent::CLASSNAME
|
||||
. CustomIdObjectTypeParent::class
|
||||
. ' parent LEFT JOIN parent.children children'
|
||||
)
|
||||
->getResult();
|
||||
@ -80,7 +80,7 @@ class CustomIdObjectTypeTest extends OrmFunctionalTestCase
|
||||
->_em
|
||||
->createQuery(
|
||||
'SELECT parent, children FROM '
|
||||
. CustomIdObjectTypeParent::CLASSNAME
|
||||
. CustomIdObjectTypeParent::class
|
||||
. ' parent LEFT JOIN parent.children children '
|
||||
. 'WHERE children.id = ?1'
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -16,8 +17,8 @@ class DefaultValuesTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\DefaultValueUser'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\DefaultValueAddress')
|
||||
$this->_em->getClassMetadata(DefaultValueUser::class),
|
||||
$this->_em->getClassMetadata(DefaultValueAddress::class)
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -55,7 +56,7 @@ class DefaultValuesTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$a2 = $this->_em->find(get_class($a), $a->id);
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\DefaultValueUser', $a2->getUser());
|
||||
$this->assertInstanceOf(DefaultValueUser::class, $a2->getUser());
|
||||
$this->assertEquals($userId, $a2->getUser()->getId());
|
||||
$this->assertEquals('Poweruser', $a2->getUser()->type);
|
||||
}
|
||||
@ -73,13 +74,13 @@ class DefaultValuesTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$user = $this->_em->getPartialReference('Doctrine\Tests\ORM\Functional\DefaultValueUser', $user->id);
|
||||
$user = $this->_em->getPartialReference(DefaultValueUser::class, $user->id);
|
||||
$this->assertTrue($this->_em->getUnitOfWork()->isReadOnly($user));
|
||||
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\ORM\Functional\DefaultValueUser', $user->id);
|
||||
$user = $this->_em->find(DefaultValueUser::class, $user->id);
|
||||
|
||||
$this->assertEquals('Normaluser', $user->type);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\ORM\OptimisticLockException;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
@ -90,8 +91,8 @@ class DetachedEntityTest extends OrmFunctionalTestCase
|
||||
|
||||
// Merge back in
|
||||
$user = $this->_em->merge($user); // merge cascaded to phonenumbers
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $user->phonenumbers[0]->user);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $user->phonenumbers[1]->user);
|
||||
$this->assertInstanceOf(CmsUser::class, $user->phonenumbers[0]->user);
|
||||
$this->assertInstanceOf(CmsUser::class, $user->phonenumbers[1]->user);
|
||||
$im = $this->_em->getUnitOfWork()->getIdentityMap();
|
||||
$this->_em->flush();
|
||||
|
||||
@ -100,10 +101,10 @@ class DetachedEntityTest extends OrmFunctionalTestCase
|
||||
$this->assertNotSame($oldPhonenumbers, $phonenumbers, "Merge should replace the Detached Collection with a new PersistentCollection.");
|
||||
$this->assertEquals(2, count($phonenumbers), "Failed to assert that two phonenumbers are contained in the merged users phonenumber collection.");
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $phonenumbers[1]);
|
||||
$this->assertInstanceOf(CmsPhonenumber::class, $phonenumbers[1]);
|
||||
$this->assertTrue($this->_em->contains($phonenumbers[1]), "Failed to assert that second phonenumber in collection is contained inside EntityManager persistence context.");
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $phonenumbers[0]);
|
||||
$this->assertInstanceOf(CmsPhonenumber::class, $phonenumbers[0]);
|
||||
$this->assertTrue($this->_em->getUnitOfWork()->isInIdentityMap($phonenumbers[0]));
|
||||
$this->assertTrue($this->_em->contains($phonenumbers[0]), "Failed to assert that first phonenumber in collection is contained inside EntityManager persistence context.");
|
||||
}
|
||||
@ -145,14 +146,14 @@ class DetachedEntityTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$address2 = $this->_em->find(get_class($address), $address->id);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $address2->user);
|
||||
$this->assertInstanceOf(Proxy::class, $address2->user);
|
||||
$this->assertFalse($address2->user->__isInitialized__);
|
||||
$detachedAddress2 = unserialize(serialize($address2));
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $detachedAddress2->user);
|
||||
$this->assertInstanceOf(Proxy::class, $detachedAddress2->user);
|
||||
$this->assertFalse($detachedAddress2->user->__isInitialized__);
|
||||
|
||||
$managedAddress2 = $this->_em->merge($detachedAddress2);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $managedAddress2->user);
|
||||
$this->assertInstanceOf(Proxy::class, $managedAddress2->user);
|
||||
$this->assertFalse($managedAddress2->user === $detachedAddress2->user);
|
||||
$this->assertFalse($managedAddress2->user->__isInitialized__);
|
||||
}
|
||||
@ -178,7 +179,7 @@ class DetachedEntityTest extends OrmFunctionalTestCase
|
||||
|
||||
$newUser = $query->getSingleResult();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $newUser);
|
||||
$this->assertInstanceOf(CmsUser::class, $newUser);
|
||||
$this->assertEquals('gblanco', $newUser->username);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
|
||||
use Doctrine\ORM\Event\PreFlushEventArgs;
|
||||
use Doctrine\ORM\Event\PreUpdateEventArgs;
|
||||
use Doctrine\Tests\Models\Company\CompanyContractListener;
|
||||
use Doctrine\Tests\Models\Company\CompanyFixContract;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
@ -23,7 +27,7 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->listener = $this->_em->getConfiguration()
|
||||
->getEntityListenerResolver()
|
||||
->resolve('Doctrine\Tests\Models\Company\CompanyContractListener');
|
||||
->resolve(CompanyContractListener::class);
|
||||
}
|
||||
|
||||
public function testPreFlushListeners()
|
||||
@ -37,18 +41,9 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertCount(1,$this->listener->preFlushCalls);
|
||||
|
||||
$this->assertSame($fix, $this->listener->preFlushCalls[0][0]);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\Tests\Models\Company\CompanyFixContract',
|
||||
$this->listener->preFlushCalls[0][0]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\PreFlushEventArgs',
|
||||
$this->listener->preFlushCalls[0][1]
|
||||
);
|
||||
$this->assertInstanceOf(CompanyFixContract::class, $this->listener->preFlushCalls[0][0]);
|
||||
$this->assertInstanceOf(PreFlushEventArgs::class, $this->listener->preFlushCalls[0][1]);
|
||||
}
|
||||
|
||||
public function testPostLoadListeners()
|
||||
@ -66,18 +61,9 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
$fix = $this->_em->createQuery($dql)->setParameter(1, $fix->getId())->getSingleResult();
|
||||
|
||||
$this->assertCount(1,$this->listener->postLoadCalls);
|
||||
|
||||
$this->assertSame($fix, $this->listener->postLoadCalls[0][0]);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\Tests\Models\Company\CompanyFixContract',
|
||||
$this->listener->postLoadCalls[0][0]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$this->listener->postLoadCalls[0][1]
|
||||
);
|
||||
$this->assertInstanceOf(CompanyFixContract::class, $this->listener->postLoadCalls[0][0]);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $this->listener->postLoadCalls[0][1]);
|
||||
}
|
||||
|
||||
public function testPrePersistListeners()
|
||||
@ -91,18 +77,9 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertCount(1,$this->listener->prePersistCalls);
|
||||
|
||||
$this->assertSame($fix, $this->listener->prePersistCalls[0][0]);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\Tests\Models\Company\CompanyFixContract',
|
||||
$this->listener->prePersistCalls[0][0]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$this->listener->prePersistCalls[0][1]
|
||||
);
|
||||
$this->assertInstanceOf(CompanyFixContract::class, $this->listener->prePersistCalls[0][0]);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $this->listener->prePersistCalls[0][1]);
|
||||
}
|
||||
|
||||
public function testPostPersistListeners()
|
||||
@ -116,18 +93,9 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertCount(1,$this->listener->postPersistCalls);
|
||||
|
||||
$this->assertSame($fix, $this->listener->postPersistCalls[0][0]);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\Tests\Models\Company\CompanyFixContract',
|
||||
$this->listener->postPersistCalls[0][0]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$this->listener->postPersistCalls[0][1]
|
||||
);
|
||||
$this->assertInstanceOf(CompanyFixContract::class, $this->listener->postPersistCalls[0][0]);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $this->listener->postPersistCalls[0][1]);
|
||||
}
|
||||
|
||||
public function testPreUpdateListeners()
|
||||
@ -146,18 +114,9 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertCount(1,$this->listener->preUpdateCalls);
|
||||
|
||||
$this->assertSame($fix, $this->listener->preUpdateCalls[0][0]);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\Tests\Models\Company\CompanyFixContract',
|
||||
$this->listener->preUpdateCalls[0][0]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\PreUpdateEventArgs',
|
||||
$this->listener->preUpdateCalls[0][1]
|
||||
);
|
||||
$this->assertInstanceOf(CompanyFixContract::class, $this->listener->preUpdateCalls[0][0]);
|
||||
$this->assertInstanceOf(PreUpdateEventArgs::class, $this->listener->preUpdateCalls[0][1]);
|
||||
}
|
||||
|
||||
public function testPostUpdateListeners()
|
||||
@ -176,18 +135,9 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertCount(1,$this->listener->postUpdateCalls);
|
||||
|
||||
$this->assertSame($fix, $this->listener->postUpdateCalls[0][0]);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\Tests\Models\Company\CompanyFixContract',
|
||||
$this->listener->postUpdateCalls[0][0]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$this->listener->postUpdateCalls[0][1]
|
||||
);
|
||||
$this->assertInstanceOf(CompanyFixContract::class, $this->listener->postUpdateCalls[0][0]);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $this->listener->postUpdateCalls[0][1]);
|
||||
}
|
||||
|
||||
public function testPreRemoveListeners()
|
||||
@ -204,18 +154,9 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertCount(1,$this->listener->preRemoveCalls);
|
||||
|
||||
$this->assertSame($fix, $this->listener->preRemoveCalls[0][0]);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\Tests\Models\Company\CompanyFixContract',
|
||||
$this->listener->preRemoveCalls[0][0]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$this->listener->preRemoveCalls[0][1]
|
||||
);
|
||||
$this->assertInstanceOf(CompanyFixContract::class, $this->listener->preRemoveCalls[0][0]);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $this->listener->preRemoveCalls[0][1]);
|
||||
}
|
||||
|
||||
public function testPostRemoveListeners()
|
||||
@ -232,17 +173,8 @@ class EntityListenersTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertCount(1,$this->listener->postRemoveCalls);
|
||||
|
||||
$this->assertSame($fix, $this->listener->postRemoveCalls[0][0]);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\Tests\Models\Company\CompanyFixContract',
|
||||
$this->listener->postRemoveCalls[0][0]
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$this->listener->postRemoveCalls[0][1]
|
||||
);
|
||||
$this->assertInstanceOf(CompanyFixContract::class, $this->listener->postRemoveCalls[0][0]);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $this->listener->postRemoveCalls[0][1]);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\ORM\LazyCriteriaCollection;
|
||||
use Doctrine\Tests\Models\Generic\DateTimeModel;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Tests\Models\Tweet\Tweet;
|
||||
@ -64,7 +65,7 @@ class EntityRepositoryCriteriaTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\Generic\DateTimeModel');
|
||||
$repository = $this->_em->getRepository(DateTimeModel::class);
|
||||
$dates = $repository->matching(new Criteria(
|
||||
Criteria::expr()->lte('datetime', new \DateTime('today'))
|
||||
));
|
||||
@ -95,7 +96,7 @@ class EntityRepositoryCriteriaTest extends OrmFunctionalTestCase
|
||||
public function testIsNullComparison()
|
||||
{
|
||||
$this->loadNullFieldFixtures();
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\Generic\DateTimeModel');
|
||||
$repository = $this->_em->getRepository(DateTimeModel::class);
|
||||
|
||||
$dates = $repository->matching(new Criteria(
|
||||
Criteria::expr()->isNull('time')
|
||||
@ -107,7 +108,7 @@ class EntityRepositoryCriteriaTest extends OrmFunctionalTestCase
|
||||
public function testEqNullComparison()
|
||||
{
|
||||
$this->loadNullFieldFixtures();
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\Generic\DateTimeModel');
|
||||
$repository = $this->_em->getRepository(DateTimeModel::class);
|
||||
|
||||
$dates = $repository->matching(new Criteria(
|
||||
Criteria::expr()->eq('time', null)
|
||||
@ -119,7 +120,7 @@ class EntityRepositoryCriteriaTest extends OrmFunctionalTestCase
|
||||
public function testNotEqNullComparison()
|
||||
{
|
||||
$this->loadNullFieldFixtures();
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\Generic\DateTimeModel');
|
||||
$repository = $this->_em->getRepository(DateTimeModel::class);
|
||||
|
||||
$dates = $repository->matching(new Criteria(
|
||||
Criteria::expr()->neq('time', null)
|
||||
@ -131,7 +132,7 @@ class EntityRepositoryCriteriaTest extends OrmFunctionalTestCase
|
||||
public function testCanCountWithoutLoadingCollection()
|
||||
{
|
||||
$this->loadFixture();
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\Generic\DateTimeModel');
|
||||
$repository = $this->_em->getRepository(DateTimeModel::class);
|
||||
|
||||
$dates = $repository->matching(new Criteria());
|
||||
|
||||
@ -171,10 +172,10 @@ class EntityRepositoryCriteriaTest extends OrmFunctionalTestCase
|
||||
$criteria = new Criteria();
|
||||
$criteria->andWhere($criteria->expr()->contains('content', 'Criteria'));
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\Tweet\User', $user->id);
|
||||
$user = $this->_em->find(User::class, $user->id);
|
||||
$tweets = $user->tweets->matching($criteria);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\LazyCriteriaCollection', $tweets);
|
||||
$this->assertInstanceOf(LazyCriteriaCollection::class, $tweets);
|
||||
$this->assertFalse($tweets->isInitialized());
|
||||
|
||||
$tweets->contains($tweet);
|
||||
|
@ -2,16 +2,23 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\LockMode;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\OptimisticLockException;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\TransactionRequiredException;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\CMS\CmsEmail;
|
||||
use Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Tests\Models\CMS\CmsEmail;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\DDC753\DDC753CustomRepository;
|
||||
use Doctrine\Tests\Models\DDC753\DDC753DefaultRepository;
|
||||
use Doctrine\Tests\Models\DDC753\DDC753EntityWithCustomRepository;
|
||||
use Doctrine\Tests\Models\DDC753\DDC753EntityWithDefaultCustomRepository;
|
||||
use Doctrine\Tests\Models\DDC753\DDC753InvalidRepository;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -170,10 +177,10 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testBasicFind()
|
||||
{
|
||||
$user1Id = $this->loadFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$user = $repos->find($user1Id);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$user);
|
||||
$this->assertInstanceOf(CmsUser::class,$user);
|
||||
$this->assertEquals('Roman', $user->name);
|
||||
$this->assertEquals('freak', $user->status);
|
||||
}
|
||||
@ -181,11 +188,11 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindByField()
|
||||
{
|
||||
$user1Id = $this->loadFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$users = $repos->findBy(['status' => 'dev']);
|
||||
$this->assertEquals(2, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class,$users[0]);
|
||||
$this->assertEquals('Guilherme', $users[0]->name);
|
||||
$this->assertEquals('dev', $users[0]->status);
|
||||
}
|
||||
@ -207,11 +214,11 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repository = $this->_em->getRepository(CmsAddress::class);
|
||||
$addresses = $repository->findBy(['user' => [$user1->getId(), $user2->getId()]]);
|
||||
|
||||
$this->assertEquals(2, count($addresses));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress',$addresses[0]);
|
||||
$this->assertInstanceOf(CmsAddress::class,$addresses[0]);
|
||||
}
|
||||
|
||||
public function testFindByAssociationWithObjectAsParameter()
|
||||
@ -231,21 +238,21 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repository = $this->_em->getRepository(CmsAddress::class);
|
||||
$addresses = $repository->findBy(['user' => [$user1, $user2]]);
|
||||
|
||||
$this->assertEquals(2, count($addresses));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress',$addresses[0]);
|
||||
$this->assertInstanceOf(CmsAddress::class,$addresses[0]);
|
||||
}
|
||||
|
||||
public function testFindFieldByMagicCall()
|
||||
{
|
||||
$user1Id = $this->loadFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$users = $repos->findByStatus('dev');
|
||||
$this->assertEquals(2, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class,$users[0]);
|
||||
$this->assertEquals('Guilherme', $users[0]->name);
|
||||
$this->assertEquals('dev', $users[0]->status);
|
||||
}
|
||||
@ -253,7 +260,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindAll()
|
||||
{
|
||||
$user1Id = $this->loadFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$users = $repos->findAll();
|
||||
$this->assertEquals(4, count($users));
|
||||
@ -262,7 +269,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindByAlias()
|
||||
{
|
||||
$user1Id = $this->loadFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$this->_em->getConfiguration()->addEntityNamespace('CMS', 'Doctrine\Tests\Models\CMS');
|
||||
|
||||
@ -300,7 +307,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
* @expectedException \Doctrine\ORM\ORMException
|
||||
*/
|
||||
public function testExceptionIsThrownWhenCallingFindByWithoutParameter() {
|
||||
$this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||
$this->_em->getRepository(CmsUser::class)
|
||||
->findByStatus();
|
||||
}
|
||||
|
||||
@ -308,7 +315,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
* @expectedException \Doctrine\ORM\ORMException
|
||||
*/
|
||||
public function testExceptionIsThrownWhenUsingInvalidFieldName() {
|
||||
$this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||
$this->_em->getRepository(CmsUser::class)
|
||||
->findByThisFieldDoesNotExist('testvalue');
|
||||
}
|
||||
|
||||
@ -320,7 +327,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->expectException(TransactionRequiredException::class);
|
||||
|
||||
$this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||
$this->_em->getRepository(CmsUser::class)
|
||||
->find(1, LockMode::PESSIMISTIC_READ);
|
||||
}
|
||||
|
||||
@ -332,7 +339,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->expectException(TransactionRequiredException::class);
|
||||
|
||||
$this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||
$this->_em->getRepository(CmsUser::class)
|
||||
->find(1, LockMode::PESSIMISTIC_WRITE);
|
||||
}
|
||||
|
||||
@ -344,7 +351,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->expectException(OptimisticLockException::class);
|
||||
|
||||
$this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||
$this->_em->getRepository(CmsUser::class)
|
||||
->find(1, LockMode::OPTIMISTIC);
|
||||
}
|
||||
|
||||
@ -363,11 +370,11 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
|
||||
$userId = $user->id;
|
||||
|
||||
$this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
$this->_em->find(CmsUser::class, $userId);
|
||||
|
||||
$this->expectException(OptimisticLockException::class);
|
||||
|
||||
$this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $userId, LockMode::OPTIMISTIC);
|
||||
$this->_em->find(CmsUser::class, $userId, LockMode::OPTIMISTIC);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -377,7 +384,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$users = $repos->findByStatus(null);
|
||||
$this->assertEquals(1, count($users));
|
||||
@ -390,7 +397,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->expectException(\BadMethodCallException::class);
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
$repos->foo();
|
||||
}
|
||||
|
||||
@ -400,7 +407,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindByAssociationKey_ExceptionOnInverseSide()
|
||||
{
|
||||
list($userId, $addressId) = $this->loadAssociatedFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage("You cannot search for the association field 'Doctrine\Tests\Models\CMS\CmsUser#address', because it is the inverse side of an association. Find methods only work on owning side associations.");
|
||||
@ -414,10 +421,10 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindOneByAssociationKey()
|
||||
{
|
||||
list($userId, $addressId) = $this->loadAssociatedFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repos = $this->_em->getRepository(CmsAddress::class);
|
||||
$address = $repos->findOneBy(['user' => $userId]);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $address);
|
||||
$this->assertInstanceOf(CmsAddress::class, $address);
|
||||
$this->assertEquals($addressId, $address->id);
|
||||
}
|
||||
|
||||
@ -428,7 +435,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
$userAsc = $repos->findOneBy([], ["username" => "ASC"]);
|
||||
$userDesc = $repos->findOneBy([], ["username" => "DESC"]);
|
||||
|
||||
@ -441,10 +448,10 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindByAssociationKey()
|
||||
{
|
||||
list($userId, $addressId) = $this->loadAssociatedFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repos = $this->_em->getRepository(CmsAddress::class);
|
||||
$addresses = $repos->findBy(['user' => $userId]);
|
||||
|
||||
$this->assertContainsOnly('Doctrine\Tests\Models\CMS\CmsAddress', $addresses);
|
||||
$this->assertContainsOnly(CmsAddress::class, $addresses);
|
||||
$this->assertEquals(1, count($addresses));
|
||||
$this->assertEquals($addressId, $addresses[0]->id);
|
||||
}
|
||||
@ -455,10 +462,10 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindAssociationByMagicCall()
|
||||
{
|
||||
list($userId, $addressId) = $this->loadAssociatedFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repos = $this->_em->getRepository(CmsAddress::class);
|
||||
$addresses = $repos->findByUser($userId);
|
||||
|
||||
$this->assertContainsOnly('Doctrine\Tests\Models\CMS\CmsAddress', $addresses);
|
||||
$this->assertContainsOnly(CmsAddress::class, $addresses);
|
||||
$this->assertEquals(1, count($addresses));
|
||||
$this->assertEquals($addressId, $addresses[0]->id);
|
||||
}
|
||||
@ -469,26 +476,26 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindOneAssociationByMagicCall()
|
||||
{
|
||||
list($userId, $addressId) = $this->loadAssociatedFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repos = $this->_em->getRepository(CmsAddress::class);
|
||||
$address = $repos->findOneByUser($userId);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $address);
|
||||
$this->assertInstanceOf(CmsAddress::class, $address);
|
||||
$this->assertEquals($addressId, $address->id);
|
||||
}
|
||||
|
||||
public function testValidNamedQueryRetrieval()
|
||||
{
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$query = $repos->createNamedQuery('all');
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Query', $query);
|
||||
$this->assertInstanceOf(Query::class, $query);
|
||||
$this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $query->getDQL());
|
||||
}
|
||||
|
||||
public function testInvalidNamedQueryRetrieval()
|
||||
{
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$this->expectException(\Doctrine\ORM\Mapping\MappingException::class);
|
||||
|
||||
@ -500,7 +507,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testIsNullCriteriaDoesNotGenerateAParameter()
|
||||
{
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repos->findBy(['status' => null, 'username' => 'romanb']);
|
||||
|
||||
$params = $this->_sqlLoggerStack->queries[$this->_sqlLoggerStack->currentQuery]['params'];
|
||||
@ -512,7 +519,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$users = $repos->findBy(['status' => null]);
|
||||
$this->assertEquals(1, count($users));
|
||||
@ -525,7 +532,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$users1 = $repos->findBy([], null, 1, 0);
|
||||
$users2 = $repos->findBy([], null, 1, 1);
|
||||
@ -543,7 +550,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
$usersAsc = $repos->findBy([], ["username" => "ASC"]);
|
||||
$usersDesc = $repos->findBy([], ["username" => "DESC"]);
|
||||
|
||||
@ -560,7 +567,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixtureUserEmail();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$resultAsc = $repository->findBy([], ['email' => 'ASC']);
|
||||
$resultDesc = $repository->findBy([], ['email' => 'DESC']);
|
||||
|
||||
@ -577,7 +584,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindFieldByMagicCallOrderBy()
|
||||
{
|
||||
$this->loadFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$usersAsc = $repos->findByStatus('dev', ['username' => "ASC"]);
|
||||
$usersDesc = $repos->findByStatus('dev', ['username' => "DESC"]);
|
||||
@ -585,7 +592,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$this->assertEquals(2, count($usersAsc));
|
||||
$this->assertEquals(2, count($usersDesc));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser',$usersAsc[0]);
|
||||
$this->assertInstanceOf(CmsUser::class,$usersAsc[0]);
|
||||
$this->assertEquals('Alexander', $usersAsc[0]->name);
|
||||
$this->assertEquals('dev', $usersAsc[0]->status);
|
||||
|
||||
@ -599,7 +606,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testFindFieldByMagicCallLimitOffset()
|
||||
{
|
||||
$this->loadFixture();
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repos = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$users1 = $repos->findByStatus('dev', [], 1, 0);
|
||||
$users2 = $repos->findByStatus('dev', [], 1, 1);
|
||||
@ -614,22 +621,22 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testDefaultRepositoryClassName()
|
||||
{
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), "Doctrine\ORM\EntityRepository");
|
||||
$this->_em->getConfiguration()->setDefaultRepositoryClassName("Doctrine\Tests\Models\DDC753\DDC753DefaultRepository");
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), "Doctrine\Tests\Models\DDC753\DDC753DefaultRepository");
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), EntityRepository::class);
|
||||
$this->_em->getConfiguration()->setDefaultRepositoryClassName(DDC753DefaultRepository::class);
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), DDC753DefaultRepository::class);
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\DDC753\DDC753EntityWithDefaultCustomRepository');
|
||||
$this->assertInstanceOf("Doctrine\Tests\Models\DDC753\DDC753DefaultRepository", $repos);
|
||||
$repos = $this->_em->getRepository(DDC753EntityWithDefaultCustomRepository::class);
|
||||
$this->assertInstanceOf(DDC753DefaultRepository::class, $repos);
|
||||
$this->assertTrue($repos->isDefaultRepository());
|
||||
|
||||
|
||||
$repos = $this->_em->getRepository('Doctrine\Tests\Models\DDC753\DDC753EntityWithCustomRepository');
|
||||
$this->assertInstanceOf("Doctrine\Tests\Models\DDC753\DDC753CustomRepository", $repos);
|
||||
$repos = $this->_em->getRepository(DDC753EntityWithCustomRepository::class);
|
||||
$this->assertInstanceOf(DDC753CustomRepository::class, $repos);
|
||||
$this->assertTrue($repos->isCustomRepository());
|
||||
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), "Doctrine\Tests\Models\DDC753\DDC753DefaultRepository");
|
||||
$this->_em->getConfiguration()->setDefaultRepositoryClassName("Doctrine\ORM\EntityRepository");
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), "Doctrine\ORM\EntityRepository");
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), DDC753DefaultRepository::class);
|
||||
$this->_em->getConfiguration()->setDefaultRepositoryClassName(EntityRepository::class);
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), EntityRepository::class);
|
||||
|
||||
}
|
||||
|
||||
@ -640,8 +647,8 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testSetDefaultRepositoryInvalidClassError()
|
||||
{
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), "Doctrine\ORM\EntityRepository");
|
||||
$this->_em->getConfiguration()->setDefaultRepositoryClassName("Doctrine\Tests\Models\DDC753\DDC753InvalidRepository");
|
||||
$this->assertEquals($this->_em->getConfiguration()->getDefaultRepositoryClassName(), EntityRepository::class);
|
||||
$this->_em->getConfiguration()->setDefaultRepositoryClassName(DDC753InvalidRepository::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -654,7 +661,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$config->addEntityNamespace('Aliased', 'Doctrine\Tests\Models\CMS');
|
||||
$config->addEntityNamespace('AliasedAgain', 'Doctrine\Tests\Models\CMS');
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$this->assertSame($repository, $this->_em->getRepository('Aliased:CmsUser'));
|
||||
$this->assertSame($repository, $this->_em->getRepository('AliasedAgain:CmsUser'));
|
||||
@ -666,8 +673,8 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
public function testCanRetrieveRepositoryFromClassNameWithLeadingBackslash()
|
||||
{
|
||||
$this->assertSame(
|
||||
$this->_em->getRepository('\\Doctrine\\Tests\\Models\\CMS\\CmsUser'),
|
||||
$this->_em->getRepository('Doctrine\\Tests\\Models\\CMS\\CmsUser')
|
||||
$this->_em->getRepository('\\' . CmsUser::class),
|
||||
$this->_em->getRepository(CmsUser::class)
|
||||
);
|
||||
}
|
||||
|
||||
@ -679,7 +686,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testInvalidOrderByAssociation()
|
||||
{
|
||||
$this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||
$this->_em->getRepository(CmsUser::class)
|
||||
->findBy(['status' => 'test'], ['address' => 'ASC']);
|
||||
}
|
||||
|
||||
@ -691,7 +698,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage('Invalid order by orientation specified for Doctrine\Tests\Models\CMS\CmsUser#username');
|
||||
|
||||
$repo = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repo = $this->_em->getRepository(CmsUser::class);
|
||||
$repo->findBy(['status' => 'test'], ['username' => 'INVALID']);
|
||||
}
|
||||
|
||||
@ -700,7 +707,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testFindByAssociationArray()
|
||||
{
|
||||
$repo = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsArticle');
|
||||
$repo = $this->_em->getRepository(CmsAddress::class);
|
||||
$data = $repo->findBy(['user' => [1, 2, 3]]);
|
||||
|
||||
$query = array_pop($this->_sqlLoggerStack->queries);
|
||||
@ -715,7 +722,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria());
|
||||
|
||||
$this->assertEquals(4, count($users));
|
||||
@ -728,7 +735,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->eq('username', 'beberlei')
|
||||
));
|
||||
@ -743,7 +750,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->neq('username', 'beberlei')
|
||||
));
|
||||
@ -758,7 +765,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->in('username', ['beberlei', 'gblanco'])
|
||||
));
|
||||
@ -773,7 +780,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->notIn('username', ['beberlei', 'gblanco', 'asm89'])
|
||||
));
|
||||
@ -788,7 +795,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$firstUserId = $this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->lt('id', $firstUserId + 1)
|
||||
));
|
||||
@ -803,7 +810,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$firstUserId = $this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->lte('id', $firstUserId + 1)
|
||||
));
|
||||
@ -818,7 +825,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$firstUserId = $this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->gt('id', $firstUserId)
|
||||
));
|
||||
@ -833,7 +840,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$firstUserId = $this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$users = $repository->matching(new Criteria(
|
||||
Criteria::expr()->gte('id', $firstUserId)
|
||||
));
|
||||
@ -848,13 +855,13 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
list($userId, $addressId) = $this->loadAssociatedFixture();
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
$user = $this->_em->find(CmsUser::class, $userId);
|
||||
|
||||
$criteria = new Criteria(
|
||||
Criteria::expr()->eq('user', $user)
|
||||
);
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repository = $this->_em->getRepository(CmsAddress::class);
|
||||
$addresses = $repository->matching($criteria);
|
||||
|
||||
$this->assertEquals(1, count($addresses));
|
||||
@ -871,13 +878,13 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
list($userId, $addressId) = $this->loadAssociatedFixture();
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
$user = $this->_em->find(CmsUser::class, $userId);
|
||||
|
||||
$criteria = new Criteria(
|
||||
Criteria::expr()->in('user', [$user])
|
||||
);
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repository = $this->_em->getRepository(CmsAddress::class);
|
||||
$addresses = $repository->matching($criteria);
|
||||
|
||||
$this->assertEquals(1, count($addresses));
|
||||
@ -891,7 +898,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$users = $repository->matching(new Criteria(Criteria::expr()->contains('name', 'Foobar')));
|
||||
$this->assertEquals(0, count($users));
|
||||
@ -910,7 +917,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$fixtures = $this->loadFixtureUserEmail();
|
||||
$user = $this->_em->merge($fixtures[0]);
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$criteriaIsNull = Criteria::create()->where(Criteria::expr()->isNull('email'));
|
||||
$criteriaEqNull = Criteria::create()->where(Criteria::expr()->eq('email', null));
|
||||
|
||||
@ -925,8 +932,8 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$this->assertCount(1, $usersIsNull);
|
||||
$this->assertCount(1, $usersEqNull);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $usersIsNull[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $usersEqNull[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $usersIsNull[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $usersEqNull[0]);
|
||||
|
||||
$this->assertNull($usersIsNull[0]->getEmail());
|
||||
$this->assertNull($usersEqNull[0]->getEmail());
|
||||
@ -937,11 +944,11 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCreateResultSetMappingBuilder()
|
||||
{
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$rsm = $repository->createResultSetMappingBuilder('u');
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\Query\ResultSetMappingBuilder', $rsm);
|
||||
$this->assertEquals(['u' => 'Doctrine\Tests\Models\CMS\CmsUser'], $rsm->aliasMap);
|
||||
$this->assertInstanceOf(Query\ResultSetMappingBuilder::class, $rsm);
|
||||
$this->assertEquals(['u' => CmsUser::class], $rsm->aliasMap);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -952,7 +959,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage('Unrecognized field: ');
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$repository->findBy(['username = ?; DELETE FROM cms_users; SELECT 1 WHERE 1' => 'test']);
|
||||
}
|
||||
|
||||
@ -964,7 +971,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage('Unrecognized field: ');
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$repository->findOneBy(['username = ?; DELETE FROM cms_users; SELECT 1 WHERE 1' => 'test']);
|
||||
}
|
||||
|
||||
@ -976,7 +983,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage('Unrecognized field: ');
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$result = $repository->matching(new Criteria(
|
||||
Criteria::expr()->eq('username = ?; DELETE FROM cms_users; SELECT 1 WHERE 1', 'beberlei')
|
||||
));
|
||||
@ -993,7 +1000,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$this->expectException(ORMException::class);
|
||||
$this->expectExceptionMessage('Unrecognized identifier fields: ');
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$repository->find(['username = ?; DELETE FROM cms_users; SELECT 1 WHERE 1' => 'test', 'id' => 1]);
|
||||
}
|
||||
|
||||
@ -1016,7 +1023,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
$this->_em->persist($user2);
|
||||
$this->_em->flush();
|
||||
|
||||
$users = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->findBy(['status' => [null]]);
|
||||
$users = $this->_em->getRepository(CmsUser::class)->findBy(['status' => [null]]);
|
||||
|
||||
$this->assertCount(1, $users);
|
||||
$this->assertSame($user1, reset($users));
|
||||
@ -1043,7 +1050,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
|
||||
$users = $this
|
||||
->_em
|
||||
->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||
->getRepository(CmsUser::class)
|
||||
->findBy(['status' => ['foo', null]]);
|
||||
|
||||
$this->assertCount(1, $users);
|
||||
@ -1071,7 +1078,7 @@ class EntityRepositoryTest extends OrmFunctionalTestCase
|
||||
|
||||
$users = $this
|
||||
->_em
|
||||
->getRepository('Doctrine\Tests\Models\CMS\CmsUser')
|
||||
->getRepository(CmsUser::class)
|
||||
->findBy(['status' => ['dbal maintainer', null]]);
|
||||
|
||||
$this->assertCount(2, $users);
|
||||
|
@ -40,7 +40,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
$this->useModelSet('ddc2504');
|
||||
parent::setUp();
|
||||
|
||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$class = $this->_em->getClassMetadata(CmsUser::class);
|
||||
$class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
|
||||
$class->associationMappings['groups']['indexBy'] = 'name';
|
||||
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
|
||||
@ -52,7 +52,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
unset($class->associationMappings['articles']['cache']);
|
||||
unset($class->associationMappings['users']['cache']);
|
||||
|
||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsGroup');
|
||||
$class = $this->_em->getClassMetadata(CmsGroup::class);
|
||||
$class->associationMappings['users']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
|
||||
$class->associationMappings['users']['indexBy'] = 'username';
|
||||
|
||||
@ -63,7 +63,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$class = $this->_em->getClassMetadata(CmsUser::class);
|
||||
$class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
|
||||
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
|
||||
$class->associationMappings['phonenumbers']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
|
||||
@ -72,7 +72,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
unset($class->associationMappings['articles']['indexBy']);
|
||||
unset($class->associationMappings['phonenumbers']['indexBy']);
|
||||
|
||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsGroup');
|
||||
$class = $this->_em->getClassMetadata(CmsGroup::class);
|
||||
$class->associationMappings['users']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
|
||||
|
||||
unset($class->associationMappings['users']['indexBy']);
|
||||
@ -84,7 +84,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCountNotInitializesCollection()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$this->assertFalse($user->groups->isInitialized());
|
||||
@ -101,7 +101,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCountWhenNewEntityPresent()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$newGroup = new CmsGroup();
|
||||
$newGroup->name = "Test4";
|
||||
@ -120,7 +120,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCountWhenInitialized()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
foreach ($user->groups AS $group) { }
|
||||
@ -135,7 +135,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCountInverseCollection()
|
||||
{
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
$this->assertFalse($group->users->isInitialized(), "Pre-Condition");
|
||||
|
||||
$this->assertEquals(4, count($group->users));
|
||||
@ -147,7 +147,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCountOneToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertFalse($user->groups->isInitialized(), "Pre-Condition");
|
||||
|
||||
$this->assertEquals(2, count($user->articles));
|
||||
@ -158,7 +158,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCountOneToManyJoinedInheritance()
|
||||
{
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
|
||||
$this->assertFalse($otherClass->childClasses->isInitialized(), "Pre-Condition");
|
||||
$this->assertEquals(2, count($otherClass->childClasses));
|
||||
@ -169,7 +169,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testFullSlice()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertFalse($user->groups->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
$someGroups = $user->groups->slice(null);
|
||||
@ -182,20 +182,20 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testSlice()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertFalse($user->groups->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$someGroups = $user->groups->slice(0, 2);
|
||||
|
||||
$this->assertContainsOnly('Doctrine\Tests\Models\CMS\CmsGroup', $someGroups);
|
||||
$this->assertContainsOnly(CmsGroup::class, $someGroups);
|
||||
$this->assertEquals(2, count($someGroups));
|
||||
$this->assertFalse($user->groups->isInitialized(), "Slice should not initialize the collection if it wasn't before!");
|
||||
|
||||
$otherGroup = $user->groups->slice(2, 1);
|
||||
|
||||
$this->assertContainsOnly('Doctrine\Tests\Models\CMS\CmsGroup', $otherGroup);
|
||||
$this->assertContainsOnly(CmsGroup::class, $otherGroup);
|
||||
$this->assertEquals(1, count($otherGroup));
|
||||
$this->assertFalse($user->groups->isInitialized());
|
||||
|
||||
@ -213,7 +213,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testSliceInitializedCollection()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
foreach ($user->groups AS $group) { }
|
||||
@ -232,15 +232,15 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testSliceInverseCollection()
|
||||
{
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
$this->assertFalse($group->users->isInitialized(), "Pre-Condition");
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$someUsers = $group->users->slice(0, 2);
|
||||
$otherUsers = $group->users->slice(2, 2);
|
||||
|
||||
$this->assertContainsOnly('Doctrine\Tests\Models\CMS\CmsUser', $someUsers);
|
||||
$this->assertContainsOnly('Doctrine\Tests\Models\CMS\CmsUser', $otherUsers);
|
||||
$this->assertContainsOnly(CmsUser::class, $someUsers);
|
||||
$this->assertContainsOnly(CmsUser::class, $otherUsers);
|
||||
$this->assertEquals(2, count($someUsers));
|
||||
$this->assertEquals(2, count($otherUsers));
|
||||
|
||||
@ -253,7 +253,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testSliceOneToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertFalse($user->articles->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
@ -269,11 +269,11 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testContainsOneToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertFalse($user->articles->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
// Test One to Many existence retrieved from DB
|
||||
$article = $this->_em->find('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId);
|
||||
$article = $this->_em->find(CmsArticle::class, $this->articleId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$this->assertTrue($user->articles->contains($article));
|
||||
@ -317,7 +317,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testLazyOneToManyJoinedInheritanceIsLazilyInitialized()
|
||||
{
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
|
||||
$this->assertFalse($otherClass->childClasses->isInitialized(), 'Collection is not initialized.');
|
||||
}
|
||||
@ -327,10 +327,10 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testContainsOnOneToManyJoinedInheritanceWillNotInitializeCollectionWhenMatchingItemIsFound()
|
||||
{
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
|
||||
// Test One to Many existence retrieved from DB
|
||||
$childClass = $this->_em->find(DDC2504ChildClass::CLASSNAME, $this->ddc2504ChildClassId);
|
||||
$childClass = $this->_em->find(DDC2504ChildClass::class, $this->ddc2504ChildClassId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$this->assertTrue($otherClass->childClasses->contains($childClass));
|
||||
@ -343,7 +343,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testContainsOnOneToManyJoinedInheritanceWillNotCauseQueriesWhenNonPersistentItemIsMatched()
|
||||
{
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$this->assertFalse($otherClass->childClasses->contains(new DDC2504ChildClass()));
|
||||
@ -359,7 +359,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testContainsOnOneToManyJoinedInheritanceWillNotInitializeCollectionWithClearStateMatchingItem()
|
||||
{
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
$childClass = new DDC2504ChildClass();
|
||||
|
||||
// Test One to Many existence with state clear
|
||||
@ -377,7 +377,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testContainsOnOneToManyJoinedInheritanceWillNotInitializeCollectionWithNewStateNotMatchingItem()
|
||||
{
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
$childClass = new DDC2504ChildClass();
|
||||
|
||||
$this->_em->persist($childClass);
|
||||
@ -394,7 +394,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCountingOnOneToManyJoinedInheritanceWillNotInitializeCollection()
|
||||
{
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
|
||||
$this->assertEquals(2, count($otherClass->childClasses));
|
||||
|
||||
@ -406,11 +406,11 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testContainsManyToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertFalse($user->groups->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
// Test Many to Many existence retrieved from DB
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$this->assertTrue($user->groups->contains($group));
|
||||
@ -455,10 +455,10 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testContainsManyToManyInverse()
|
||||
{
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
$this->assertFalse($group->users->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
$this->assertTrue($group->users->contains($user));
|
||||
@ -479,11 +479,11 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testRemoveElementOneToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertFalse($user->articles->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
// Test One to Many removal with Entity retrieved from DB
|
||||
$article = $this->_em->find('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId);
|
||||
$article = $this->_em->find(CmsArticle::class, $this->articleId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$user->articles->removeElement($article);
|
||||
@ -533,9 +533,9 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
public function testRemovalOfManagedElementFromOneToManyJoinedInheritanceCollectionDoesNotInitializeIt()
|
||||
{
|
||||
/* @var $otherClass DDC2504OtherClass */
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
/* @var $childClass DDC2504ChildClass */
|
||||
$childClass = $this->_em->find(DDC2504ChildClass::CLASSNAME, $this->ddc2504ChildClassId);
|
||||
$childClass = $this->_em->find(DDC2504ChildClass::class, $this->ddc2504ChildClassId);
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
@ -571,7 +571,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
public function testRemovalOfNonManagedElementFromOneToManyJoinedInheritanceCollectionDoesNotInitializeIt()
|
||||
{
|
||||
/* @var $otherClass DDC2504OtherClass */
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$otherClass->childClasses->removeElement(new DDC2504ChildClass());
|
||||
@ -589,7 +589,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
public function testRemovalOfNewElementFromOneToManyJoinedInheritanceCollectionDoesNotInitializeIt()
|
||||
{
|
||||
/* @var $otherClass DDC2504OtherClass */
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
$childClass = new DDC2504ChildClass();
|
||||
|
||||
$this->_em->persist($childClass);
|
||||
@ -610,7 +610,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testRemovalOfNewManagedElementFromOneToManyJoinedInheritanceCollectionDoesNotInitializeIt()
|
||||
{
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
$childClass = new DDC2504ChildClass();
|
||||
|
||||
$this->_em->persist($childClass);
|
||||
@ -633,11 +633,11 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testRemoveElementManyToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertFalse($user->groups->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
// Test Many to Many removal with Entity retrieved from DB
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$user->groups->removeElement($group);
|
||||
@ -686,10 +686,10 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testRemoveElementManyToManyInverse()
|
||||
{
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
$this->assertFalse($group->users->isInitialized(), "Pre-Condition: Collection is not initialized.");
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
$group->users->removeElement($user);
|
||||
@ -713,7 +713,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testCountAfterAddThenFlush()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$newGroup = new CmsGroup();
|
||||
$newGroup->name = "Test4";
|
||||
@ -736,7 +736,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testSliceOnDirtyCollection()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
/* @var $user CmsUser */
|
||||
|
||||
$newGroup = new CmsGroup();
|
||||
@ -758,7 +758,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testGetIndexByIdentifier()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
/* @var $user CmsUser */
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
@ -766,7 +766,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertFalse($user->phonenumbers->isInitialized());
|
||||
$this->assertEquals($queryCount + 1, $this->getCurrentQueryCount());
|
||||
$this->assertSame($phonenumber, $this->_em->find('Doctrine\Tests\Models\CMS\CmsPhonenumber', $this->phonenumber));
|
||||
$this->assertSame($phonenumber, $this->_em->find(CmsPhonenumber::class, $this->phonenumber));
|
||||
|
||||
$article = $user->phonenumbers->get($this->phonenumber);
|
||||
$this->assertEquals($queryCount + 1, $this->getCurrentQueryCount(), "Getting the same entity should not cause an extra query to be executed");
|
||||
@ -777,7 +777,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testGetIndexByOneToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
/* @var $user CmsUser */
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
@ -786,7 +786,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertFalse($user->articles->isInitialized());
|
||||
$this->assertEquals($queryCount + 1, $this->getCurrentQueryCount());
|
||||
$this->assertSame($article, $this->_em->find('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId));
|
||||
$this->assertSame($article, $this->_em->find(CmsArticle::class, $this->articleId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -794,7 +794,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testGetIndexByManyToManyInverseSide()
|
||||
{
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
/* @var $group CmsGroup */
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
@ -803,7 +803,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertFalse($group->users->isInitialized());
|
||||
$this->assertEquals($queryCount + 1, $this->getCurrentQueryCount());
|
||||
$this->assertSame($user, $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId));
|
||||
$this->assertSame($user, $this->_em->find(CmsUser::class, $this->userId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -811,7 +811,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testGetIndexByManyToManyOwningSide()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
/* @var $user CmsUser */
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
@ -820,7 +820,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertFalse($user->groups->isInitialized());
|
||||
$this->assertEquals($queryCount + 1, $this->getCurrentQueryCount());
|
||||
$this->assertSame($group, $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId));
|
||||
$this->assertSame($group, $this->_em->find(CmsGroup::class, $this->groupId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -828,14 +828,14 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testGetNonExistentIndexBy()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertNull($user->articles->get(-1));
|
||||
$this->assertNull($user->groups->get(-1));
|
||||
}
|
||||
|
||||
public function testContainsKeyIndexByOneToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
/* @var $user CmsUser */
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
@ -849,10 +849,10 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testContainsKeyIndexByOneToManyJoinedInheritance()
|
||||
{
|
||||
$class = $this->_em->getClassMetadata(DDC2504OtherClass::CLASSNAME);
|
||||
$class = $this->_em->getClassMetadata(DDC2504OtherClass::class);
|
||||
$class->associationMappings['childClasses']['indexBy'] = 'id';
|
||||
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::CLASSNAME, $this->ddc2504OtherClassId);
|
||||
$otherClass = $this->_em->find(DDC2504OtherClass::class, $this->ddc2504OtherClassId);
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
@ -865,9 +865,9 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testContainsKeyIndexByManyToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId2);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId2);
|
||||
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
@ -879,8 +879,8 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
}
|
||||
public function testContainsKeyIndexByManyToManyNonOwning()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId2);
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId2);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
@ -893,10 +893,10 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testContainsKeyIndexByWithPkManyToMany()
|
||||
{
|
||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$class = $this->_em->getClassMetadata(CmsUser::class);
|
||||
$class->associationMappings['groups']['indexBy'] = 'id';
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId2);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId2);
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
@ -908,10 +908,10 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
}
|
||||
public function testContainsKeyIndexByWithPkManyToManyNonOwning()
|
||||
{
|
||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsGroup');
|
||||
$class = $this->_em->getClassMetadata(CmsGroup::class);
|
||||
$class->associationMappings['users']['indexBy'] = 'id';
|
||||
|
||||
$group = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId);
|
||||
$group = $this->_em->find(CmsGroup::class, $this->groupId);
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
@ -924,7 +924,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testContainsKeyNonExistentIndexByOneToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId2);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId2);
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
|
||||
@ -937,7 +937,7 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testContainsKeyNonExistentIndexByManyToMany()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId2);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId2);
|
||||
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
@ -1061,14 +1061,14 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
list($userId, $tweetId) = $this->loadTweetFixture();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
|
||||
$user->tweets->removeElement($this->_em->find(Tweet::CLASSNAME, $tweetId));
|
||||
$user->tweets->removeElement($this->_em->find(Tweet::class, $tweetId));
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
|
||||
$this->assertCount(1, $user->tweets, 'Element was not removed - need to update the owning side first');
|
||||
}
|
||||
@ -1081,23 +1081,23 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
list($userId, $tweetId) = $this->loadTweetFixture();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$tweet = $this->_em->find(Tweet::CLASSNAME, $tweetId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
$tweet = $this->_em->find(Tweet::class, $tweetId);
|
||||
|
||||
$user->tweets->removeElement($tweet);
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
/* @var $tweet Tweet */
|
||||
$tweet = $this->_em->find(Tweet::CLASSNAME, $tweetId);
|
||||
$tweet = $this->_em->find(Tweet::class, $tweetId);
|
||||
$this->assertInstanceOf(
|
||||
Tweet::CLASSNAME,
|
||||
Tweet::class,
|
||||
$tweet,
|
||||
'Even though the collection is extra lazy, the tweet should not have been deleted'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
User::CLASSNAME,
|
||||
User::class,
|
||||
$tweet->author,
|
||||
'Tweet author link has not been removed - need to update the owning side first'
|
||||
);
|
||||
@ -1111,25 +1111,25 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
list($userId, $tweetId) = $this->loadTweetFixture();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$tweet = $this->_em->getReference(Tweet::CLASSNAME, $tweetId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
$tweet = $this->_em->getReference(Tweet::class, $tweetId);
|
||||
|
||||
$user->tweets->removeElement($this->_em->getReference(Tweet::CLASSNAME, $tweetId));
|
||||
$user->tweets->removeElement($this->_em->getReference(Tweet::class, $tweetId));
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
/* @var $tweet Tweet */
|
||||
$tweet = $this->_em->find(Tweet::CLASSNAME, $tweet->id);
|
||||
$tweet = $this->_em->find(Tweet::class, $tweet->id);
|
||||
$this->assertInstanceOf(
|
||||
Tweet::CLASSNAME,
|
||||
Tweet::class,
|
||||
$tweet,
|
||||
'Even though the collection is extra lazy, the tweet should not have been deleted'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(User::CLASSNAME, $tweet->author);
|
||||
$this->assertInstanceOf(User::class, $tweet->author);
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
|
||||
$this->assertCount(1, $user->tweets, 'Element was not removed - need to update the owning side first');
|
||||
}
|
||||
@ -1142,18 +1142,18 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
list($userId, $userListId) = $this->loadUserListFixture();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
|
||||
$user->userLists->removeElement($this->_em->find(UserList::CLASSNAME, $userListId));
|
||||
$user->userLists->removeElement($this->_em->find(UserList::class, $userListId));
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
|
||||
$this->assertCount(0, $user->userLists, 'Element was removed from association due to orphan removal');
|
||||
$this->assertNull(
|
||||
$this->_em->find(UserList::CLASSNAME, $userListId),
|
||||
$this->_em->find(UserList::class, $userListId),
|
||||
'Element was deleted due to orphan removal'
|
||||
);
|
||||
}
|
||||
@ -1166,22 +1166,22 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
list($userId, $userListId) = $this->loadUserListFixture();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
|
||||
$user->userLists->removeElement(new UserList());
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
/* @var $userList UserList */
|
||||
$userList = $this->_em->find(UserList::CLASSNAME, $userListId);
|
||||
$userList = $this->_em->find(UserList::class, $userListId);
|
||||
$this->assertInstanceOf(
|
||||
UserList::CLASSNAME,
|
||||
UserList::class,
|
||||
$userList,
|
||||
'Even though the collection is extra lazy + orphan removal, the user list should not have been deleted'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
User::CLASSNAME,
|
||||
User::class,
|
||||
$userList->owner,
|
||||
'User list to owner link has not been removed'
|
||||
);
|
||||
@ -1195,18 +1195,18 @@ class ExtraLazyCollectionTest extends OrmFunctionalTestCase
|
||||
list($userId, $userListId) = $this->loadUserListFixture();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
|
||||
$user->userLists->removeElement($this->_em->getReference(UserList::CLASSNAME, $userListId));
|
||||
$user->userLists->removeElement($this->_em->getReference(UserList::class, $userListId));
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
/* @var $user User */
|
||||
$user = $this->_em->find(User::CLASSNAME, $userId);
|
||||
$user = $this->_em->find(User::class, $userId);
|
||||
|
||||
$this->assertCount(0, $user->userLists, 'Element was removed from association due to orphan removal');
|
||||
$this->assertNull(
|
||||
$this->_em->find(UserList::CLASSNAME, $userListId),
|
||||
$this->_em->find(UserList::class, $userListId),
|
||||
'Element was deleted due to orphan removal'
|
||||
);
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ class IndexByAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testManyToOneFinder()
|
||||
{
|
||||
/* @var $market Doctrine\Tests\Models\StockExchange\Market */
|
||||
$market = $this->_em->find('Doctrine\Tests\Models\StockExchange\Market', $this->market->getId());
|
||||
/* @var $market Market */
|
||||
$market = $this->_em->find(Market::class, $this->market->getId());
|
||||
|
||||
$this->assertEquals(2, count($market->stocks));
|
||||
$this->assertTrue(isset($market->stocks['AAPL']), "AAPL symbol has to be key in indexed association.");
|
||||
@ -70,7 +70,7 @@ class IndexByAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testManyToMany()
|
||||
{
|
||||
$bond = $this->_em->find('Doctrine\Tests\Models\StockExchange\Bond', $this->bond->getId());
|
||||
$bond = $this->_em->find(Bond::class, $this->bond->getId());
|
||||
|
||||
$this->assertEquals(2, count($bond->stocks));
|
||||
$this->assertTrue(isset($bond->stocks['AAPL']), "AAPL symbol has to be key in indexed association.");
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\CompositeKeyInheritance\JoinedRootClass;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Doctrine\Tests\Models\CompositeKeyInheritance\JoinedChildClass;
|
||||
|
||||
@ -57,7 +58,7 @@ class JoinedTableCompositeKeyTest extends OrmFunctionalTestCase
|
||||
private function findEntity()
|
||||
{
|
||||
return $this->_em->find(
|
||||
'Doctrine\Tests\Models\CompositeKeyInheritance\JoinedRootClass',
|
||||
JoinedRootClass::class,
|
||||
['keyPart1' => 'part-1', 'keyPart2' => 'part-2']
|
||||
);
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ class LifecycleCallbackTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\LifecycleCallbackEventArgEntity'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\LifecycleCallbackTestEntity'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\LifecycleCallbackTestUser'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\LifecycleCallbackCascader'),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackEventArgEntity::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackTestEntity::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackTestUser::class),
|
||||
$this->_em->getClassMetadata(LifecycleCallbackCascader::class),
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -106,7 +106,7 @@ class LifecycleCallbackTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$reference = $this->_em->getReference('Doctrine\Tests\ORM\Functional\LifecycleCallbackTestEntity', $id);
|
||||
$reference = $this->_em->getReference(LifecycleCallbackTestEntity::class, $id);
|
||||
$this->assertFalse($reference->postLoadCallbackInvoked);
|
||||
|
||||
$reference->getValue(); // trigger proxy load
|
||||
@ -126,7 +126,7 @@ class LifecycleCallbackTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$reference = $this->_em->find('Doctrine\Tests\ORM\Functional\LifecycleCallbackTestEntity', $id);
|
||||
$reference = $this->_em->find(LifecycleCallbackTestEntity::class, $id);
|
||||
$this->assertTrue($reference->postLoadCallbackInvoked);
|
||||
$reference->postLoadCallbackInvoked = false;
|
||||
|
||||
@ -271,7 +271,7 @@ DQL;
|
||||
|
||||
public function testLifecycleCallbacksGetInherited()
|
||||
{
|
||||
$childMeta = $this->_em->getClassMetadata(__NAMESPACE__ . '\LifecycleCallbackChildEntity');
|
||||
$childMeta = $this->_em->getClassMetadata(LifecycleCallbackChildEntity::class);
|
||||
$this->assertEquals(['prePersist' => [0 => 'doStuff']], $childMeta->lifecycleCallbacks);
|
||||
}
|
||||
|
||||
@ -331,45 +331,14 @@ DQL;
|
||||
$this->assertArrayHasKey('preRemoveHandler', $e->calls);
|
||||
$this->assertArrayHasKey('postRemoveHandler', $e->calls);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\PreFlushEventArgs',
|
||||
$e->calls['preFlushHandler']
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$e->calls['postLoadHandler']
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$e->calls['prePersistHandler']
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$e->calls['postPersistHandler']
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\PreUpdateEventArgs',
|
||||
$e->calls['preUpdateHandler']
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$e->calls['postUpdateHandler']
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$e->calls['preRemoveHandler']
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'Doctrine\ORM\Event\LifecycleEventArgs',
|
||||
$e->calls['postRemoveHandler']
|
||||
);
|
||||
$this->assertInstanceOf(PreFlushEventArgs::class, $e->calls['preFlushHandler']);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $e->calls['postLoadHandler']);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $e->calls['prePersistHandler']);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $e->calls['postPersistHandler']);
|
||||
$this->assertInstanceOf(PreUpdateEventArgs::class, $e->calls['preUpdateHandler']);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $e->calls['postUpdateHandler']);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $e->calls['preRemoveHandler']);
|
||||
$this->assertInstanceOf(LifecycleEventArgs::class, $e->calls['postRemoveHandler']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,32 +46,32 @@ class GearmanLockTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testFindWithLock()
|
||||
{
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
|
||||
$this->assertLockWorked();
|
||||
}
|
||||
|
||||
public function testFindWithWriteThenReadLock()
|
||||
{
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_READ);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_READ);
|
||||
|
||||
$this->assertLockWorked();
|
||||
}
|
||||
|
||||
public function testFindWithReadThenWriteLock()
|
||||
{
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_READ);
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_READ);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
|
||||
$this->assertLockWorked();
|
||||
}
|
||||
|
||||
public function testFindWithOneLock()
|
||||
{
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::NONE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::NONE);
|
||||
|
||||
$this->assertLockDoesNotBlock();
|
||||
}
|
||||
@ -79,39 +79,39 @@ class GearmanLockTest extends OrmFunctionalTestCase
|
||||
public function testDqlWithLock()
|
||||
{
|
||||
$this->asyncDqlWithLock('SELECT a FROM Doctrine\Tests\Models\CMS\CmsArticle a', [], LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
|
||||
$this->assertLockWorked();
|
||||
}
|
||||
|
||||
public function testLock()
|
||||
{
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
|
||||
$this->assertLockWorked();
|
||||
}
|
||||
|
||||
public function testLock2()
|
||||
{
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_READ);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_READ);
|
||||
|
||||
$this->assertLockWorked();
|
||||
}
|
||||
|
||||
public function testLock3()
|
||||
{
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_READ);
|
||||
$this->asyncLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_READ);
|
||||
$this->asyncLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
|
||||
$this->assertLockWorked();
|
||||
}
|
||||
|
||||
public function testLock4()
|
||||
{
|
||||
$this->asyncFindWithLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::NONE);
|
||||
$this->asyncLock('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
$this->asyncFindWithLock(CmsArticle::class, $this->articleId, LockMode::NONE);
|
||||
$this->asyncLock(CmsArticle::class, $this->articleId, LockMode::PESSIMISTIC_WRITE);
|
||||
|
||||
$this->assertLockDoesNotBlock();
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional\Locking;
|
||||
|
||||
use Doctrine\ORM\OptimisticLockException;
|
||||
use Doctrine\DBAL\LockMode;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\LockMode;
|
||||
use Doctrine\ORM\OptimisticLockException;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
class OptimisticTest extends OrmFunctionalTestCase
|
||||
@ -16,10 +16,10 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Locking\OptimisticJoinedParent'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Locking\OptimisticJoinedChild'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Locking\OptimisticStandard'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Locking\OptimisticTimestamp')
|
||||
$this->_em->getClassMetadata(OptimisticJoinedParent::class),
|
||||
$this->_em->getClassMetadata(OptimisticJoinedChild::class),
|
||||
$this->_em->getClassMetadata(OptimisticStandard::class),
|
||||
$this->_em->getClassMetadata(OptimisticTimestamp::class)
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -175,7 +175,7 @@ class OptimisticTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$proxy = $this->_em->getReference('Doctrine\Tests\ORM\Functional\Locking\OptimisticStandard', $test->id);
|
||||
$proxy = $this->_em->getReference(OptimisticStandard::class, $test->id);
|
||||
|
||||
$this->_em->lock($proxy, LockMode::OPTIMISTIC, 1);
|
||||
}
|
||||
|
@ -2,12 +2,13 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\ORM\UnitOfWork;
|
||||
use Doctrine\Tests\Models\CMS\CmsGroup;
|
||||
use Doctrine\Tests\Models\CMS\CmsTag;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser,
|
||||
Doctrine\Tests\Models\CMS\CmsGroup,
|
||||
Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -49,7 +50,7 @@ class ManyToManyBasicAssociationTest extends OrmFunctionalTestCase
|
||||
$result = $query->getResult();
|
||||
|
||||
$this->assertEquals(2, $this->_em->getUnitOfWork()->size());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[0]);
|
||||
$this->assertEquals('Guilherme', $result[0]->name);
|
||||
$this->assertEquals(1, $result[0]->getGroups()->count());
|
||||
$groups = $result[0]->getGroups();
|
||||
@ -58,8 +59,8 @@ class ManyToManyBasicAssociationTest extends OrmFunctionalTestCase
|
||||
$this->assertEquals(UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($result[0]));
|
||||
$this->assertEquals(UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($groups[0]));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $groups);
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $groups[0]->getUsers());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $groups);
|
||||
$this->assertInstanceOf(PersistentCollection::class, $groups[0]->getUsers());
|
||||
|
||||
$groups[0]->getUsers()->clear();
|
||||
$groups->clear();
|
||||
@ -152,7 +153,7 @@ class ManyToManyBasicAssociationTest extends OrmFunctionalTestCase
|
||||
$user->groups[] = $group;
|
||||
}
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $user->groups);
|
||||
$this->assertInstanceOf(PersistentCollection::class, $user->groups);
|
||||
$this->assertTrue($user->groups->isDirty());
|
||||
|
||||
$this->assertEquals($groupCount, count($user->groups), "There should be 10 groups in the collection.");
|
||||
@ -187,7 +188,7 @@ class ManyToManyBasicAssociationTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
/* @var $freshUser CmsUser */
|
||||
$freshUser = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $user->getId());
|
||||
$freshUser = $this->_em->find(CmsUser::class, $user->getId());
|
||||
$newGroup = new CmsGroup();
|
||||
$newGroup->setName('12Monkeys');
|
||||
$freshUser->addGroup($newGroup);
|
||||
@ -202,7 +203,7 @@ class ManyToManyBasicAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$freshUser = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $user->getId());
|
||||
$freshUser = $this->_em->find(CmsUser::class, $user->getId());
|
||||
$this->assertEquals(3, count($freshUser->getGroups()));
|
||||
}
|
||||
|
||||
@ -333,7 +334,7 @@ class ManyToManyBasicAssociationTest extends OrmFunctionalTestCase
|
||||
$coll = new ArrayCollection([$group1, $group2]);
|
||||
$user->groups = $coll;
|
||||
$this->_em->flush();
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $user->groups,
|
||||
$this->assertInstanceOf(PersistentCollection::class, $user->groups,
|
||||
"UnitOfWork should have replaced ArrayCollection with PersistentCollection.");
|
||||
$this->_em->flush();
|
||||
|
||||
|
@ -115,8 +115,8 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati
|
||||
//$query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true);
|
||||
$result = $query->getResult();
|
||||
$this->assertEquals(2, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $result[1]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $result[0]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $result[1]);
|
||||
$prods1 = $result[0]->getProducts();
|
||||
$prods2 = $result[1]->getProducts();
|
||||
$this->assertTrue($prods1->isInitialized());
|
||||
@ -155,10 +155,10 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati
|
||||
$this->assertEquals(2, count($secondCategoryProducts)); // lazy-load
|
||||
$this->assertTrue($secondCategoryProducts->isInitialized());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstCategoryProducts[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstCategoryProducts[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondCategoryProducts[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondCategoryProducts[1]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $firstCategoryProducts[0]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $firstCategoryProducts[1]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $secondCategoryProducts[0]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $secondCategoryProducts[1]);
|
||||
|
||||
$this->assertCollectionEquals($firstCategoryProducts, $secondCategoryProducts);
|
||||
}
|
||||
@ -190,10 +190,10 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati
|
||||
$this->assertEquals(2, count($secondProductCategories)); // lazy-load
|
||||
$this->assertTrue($secondProductCategories->isInitialized());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $firstProductCategories[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $firstProductCategories[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $secondProductCategories[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $secondProductCategories[1]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $firstProductCategories[0]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $firstProductCategories[1]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $secondProductCategories[0]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $secondProductCategories[1]);
|
||||
|
||||
$this->assertCollectionEquals($firstProductCategories, $secondProductCategories);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia
|
||||
{
|
||||
$this->_createLoadingFixture();
|
||||
|
||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceProduct');
|
||||
$metadata = $this->_em->getClassMetadata(ECommerceProduct::class);
|
||||
$metadata->associationMappings['related']['fetch'] = ClassMetadata::FETCH_LAZY;
|
||||
|
||||
$query = $this->_em->createQuery('SELECT p FROM Doctrine\Tests\Models\ECommerce\ECommerceProduct p');
|
||||
@ -93,10 +93,10 @@ class ManyToManySelfReferentialAssociationTest extends AbstractManyToManyAssocia
|
||||
$this->assertEquals(2, count($firstRelatedBy));
|
||||
$this->assertEquals(2, count($secondRelatedBy));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstRelatedBy[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $firstRelatedBy[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondRelatedBy[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $secondRelatedBy[1]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $firstRelatedBy[0]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $firstRelatedBy[1]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $secondRelatedBy[0]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $secondRelatedBy[1]);
|
||||
|
||||
$this->assertCollectionEquals($firstRelatedBy, $secondRelatedBy);
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat
|
||||
$products = $firstCart->getProducts();
|
||||
$secondCart = $result[1];
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[1]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $products[0]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $products[1]);
|
||||
$this->assertCollectionEquals($products, $secondCart->getProducts());
|
||||
//$this->assertEquals("Doctrine 1.x Manual", $products[0]->getName());
|
||||
//$this->assertEquals("Doctrine 2.x Manual", $products[1]->getName());
|
||||
@ -77,7 +77,7 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat
|
||||
public function testLazyLoadsCollection()
|
||||
{
|
||||
$this->_createFixture();
|
||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceCart');
|
||||
$metadata = $this->_em->getClassMetadata(ECommerceCart::class);
|
||||
$metadata->associationMappings['products']['fetch'] = ClassMetadata::FETCH_LAZY;
|
||||
|
||||
$query = $this->_em->createQuery('SELECT c FROM Doctrine\Tests\Models\ECommerce\ECommerceCart c');
|
||||
@ -86,8 +86,8 @@ class ManyToManyUnidirectionalAssociationTest extends AbstractManyToManyAssociat
|
||||
$products = $firstCart->getProducts();
|
||||
$secondCart = $result[1];
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $products[1]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $products[0]);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $products[1]);
|
||||
$this->assertCollectionEquals($products, $secondCart->getProducts());
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\Models\DirectoryTree\Directory;
|
||||
use Doctrine\Tests\Models\DirectoryTree\File;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
@ -39,10 +41,10 @@ class MappedSuperclassTest extends OrmFunctionalTestCase
|
||||
|
||||
$cleanFile = $this->_em->find(get_class($file), $file->getId());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent());
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $cleanFile->getParent());
|
||||
$this->assertInstanceOf(Directory::class, $cleanFile->getParent());
|
||||
$this->assertInstanceOf(Proxy::class, $cleanFile->getParent());
|
||||
$this->assertEquals($directory->getId(), $cleanFile->getParent()->getId());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\DirectoryTree\Directory', $cleanFile->getParent()->getParent());
|
||||
$this->assertInstanceOf(Directory::class, $cleanFile->getParent()->getParent());
|
||||
$this->assertEquals($root->getId(), $cleanFile->getParent()->getParent()->getId());
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ class MergeCompositeToOneKeyTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(Country::CLASSNAME),
|
||||
$this->_em->getClassMetadata(CompositeToOneKeyState::CLASSNAME),
|
||||
$this->_em->getClassMetadata(Country::class),
|
||||
$this->_em->getClassMetadata(CompositeToOneKeyState::class),
|
||||
]
|
||||
);
|
||||
}
|
||||
@ -39,9 +39,9 @@ class MergeCompositeToOneKeyTest extends OrmFunctionalTestCase
|
||||
/* @var $merged CompositeToOneKeyState */
|
||||
$merged = $this->_em->merge($state);
|
||||
|
||||
$this->assertInstanceOf(CompositeToOneKeyState::CLASSNAME, $state);
|
||||
$this->assertInstanceOf(CompositeToOneKeyState::class, $state);
|
||||
$this->assertNotSame($state, $merged);
|
||||
$this->assertInstanceOf(Country::CLASSNAME, $merged->country);
|
||||
$this->assertInstanceOf(Country::class, $merged->country);
|
||||
$this->assertNotSame($country, $merged->country);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ use Doctrine\DBAL\Logging\DebugStack;
|
||||
use Doctrine\DBAL\Logging\SQLLogger;
|
||||
use Doctrine\ORM\Configuration;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Doctrine\Tests\Models\Generic\DateTimeModel;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
@ -31,11 +32,11 @@ class MergeProxiesTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testMergeDetachedUnInitializedProxy()
|
||||
{
|
||||
$detachedUninitialized = $this->_em->getReference(DateTimeModel::CLASSNAME, 123);
|
||||
$detachedUninitialized = $this->_em->getReference(DateTimeModel::class, 123);
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$managed = $this->_em->getReference(DateTimeModel::CLASSNAME, 123);
|
||||
$managed = $this->_em->getReference(DateTimeModel::class, 123);
|
||||
|
||||
$this->assertSame($managed, $this->_em->merge($detachedUninitialized));
|
||||
|
||||
@ -51,11 +52,11 @@ class MergeProxiesTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testMergeUnserializedUnInitializedProxy()
|
||||
{
|
||||
$detachedUninitialized = $this->_em->getReference(DateTimeModel::CLASSNAME, 123);
|
||||
$detachedUninitialized = $this->_em->getReference(DateTimeModel::class, 123);
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$managed = $this->_em->getReference(DateTimeModel::CLASSNAME, 123);
|
||||
$managed = $this->_em->getReference(DateTimeModel::class, 123);
|
||||
|
||||
$this->assertSame(
|
||||
$managed,
|
||||
@ -74,7 +75,7 @@ class MergeProxiesTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testMergeManagedProxy()
|
||||
{
|
||||
$managed = $this->_em->getReference(DateTimeModel::CLASSNAME, 123);
|
||||
$managed = $this->_em->getReference(DateTimeModel::class, 123);
|
||||
|
||||
$this->assertSame($managed, $this->_em->merge($managed));
|
||||
|
||||
@ -98,9 +99,9 @@ class MergeProxiesTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush($date);
|
||||
$this->_em->clear();
|
||||
|
||||
$managed = $this->_em->getReference(DateTimeModel::CLASSNAME, $date->id);
|
||||
$managed = $this->_em->getReference(DateTimeModel::class, $date->id);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Common\Proxy\Proxy', $managed);
|
||||
$this->assertInstanceOf(Proxy::class, $managed);
|
||||
$this->assertFalse($managed->__isInitialized());
|
||||
|
||||
$date->date = $dateTime = new \DateTime();
|
||||
@ -134,8 +135,8 @@ class MergeProxiesTest extends OrmFunctionalTestCase
|
||||
$queryCount1 = count($logger1->queries);
|
||||
$queryCount2 = count($logger2->queries);
|
||||
|
||||
$proxy1 = $em1->getReference(DateTimeModel::CLASSNAME, $file1->id);
|
||||
$proxy2 = $em2->getReference(DateTimeModel::CLASSNAME, $file1->id);
|
||||
$proxy1 = $em1->getReference(DateTimeModel::class, $file1->id);
|
||||
$proxy2 = $em2->getReference(DateTimeModel::class, $file1->id);
|
||||
$merged2 = $em2->merge($proxy1);
|
||||
|
||||
$this->assertNotSame($proxy1, $merged2);
|
||||
@ -195,10 +196,10 @@ class MergeProxiesTest extends OrmFunctionalTestCase
|
||||
$queryCount1 = count($logger1->queries);
|
||||
$queryCount2 = count($logger1->queries);
|
||||
|
||||
$unManagedProxy = $em1->getReference(DateTimeModel::CLASSNAME, $file1->id);
|
||||
$unManagedProxy = $em1->getReference(DateTimeModel::class, $file1->id);
|
||||
$mergedInstance = $em2->merge($unManagedProxy);
|
||||
|
||||
$this->assertNotInstanceOf('Doctrine\Common\Proxy\Proxy', $mergedInstance);
|
||||
$this->assertNotInstanceOf(Proxy::class, $mergedInstance);
|
||||
$this->assertNotSame($unManagedProxy, $mergedInstance);
|
||||
$this->assertFalse($unManagedProxy->__isInitialized());
|
||||
|
||||
@ -258,7 +259,7 @@ class MergeProxiesTest extends OrmFunctionalTestCase
|
||||
|
||||
$entityManager = EntityManager::create($connection, $config);
|
||||
|
||||
(new SchemaTool($entityManager))->createSchema([$entityManager->getClassMetadata(DateTimeModel::CLASSNAME)]);
|
||||
(new SchemaTool($entityManager))->createSchema([$entityManager->getClassMetadata(DateTimeModel::class)]);
|
||||
|
||||
return $entityManager;
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ class MergeSharedEntitiesTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\MSEFile'),
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\MSEPicture'),
|
||||
$this->_em->getClassMetadata(MSEFile::class),
|
||||
$this->_em->getClassMetadata(MSEPicture::class),
|
||||
]
|
||||
);
|
||||
} catch (ToolsException $ignored) {
|
||||
|
@ -3,17 +3,22 @@
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use Doctrine\ORM\Internal\Hydration\HydrationException;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\ORM\Query\Parameter;
|
||||
use Doctrine\ORM\Query\ResultSetMapping;
|
||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||
use Doctrine\ORM\Query\Parameter;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
use Doctrine\Tests\Models\CMS\CmsEmail;
|
||||
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\Company\CompanyContract;
|
||||
use Doctrine\Tests\Models\Company\CompanyEmployee;
|
||||
use Doctrine\Tests\Models\Company\CompanyFixContract;
|
||||
use Doctrine\Tests\Models\Company\CompanyFlexContract;
|
||||
use Doctrine\Tests\Models\Company\CompanyPerson;
|
||||
use Doctrine\Tests\Models\DDC3899\DDC3899FixContract;
|
||||
use Doctrine\Tests\Models\DDC3899\DDC3899User;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -45,7 +50,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$rsm = new ResultSetMapping;
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addEntityResult(CmsUser::class, 'u');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('id'), 'id');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('name'), 'name');
|
||||
|
||||
@ -55,7 +60,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$users = $query->getResult();
|
||||
|
||||
$this->assertEquals(1, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertEquals('Roman', $users[0]->name);
|
||||
}
|
||||
|
||||
@ -80,7 +85,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$rsm = new ResultSetMapping;
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\CMS\CmsAddress', 'a');
|
||||
$rsm->addEntityResult(CmsAddress::class, 'a');
|
||||
$rsm->addFieldResult('a', $this->platform->getSQLResultCasing('id'), 'id');
|
||||
$rsm->addFieldResult('a', $this->platform->getSQLResultCasing('country'), 'country');
|
||||
$rsm->addFieldResult('a', $this->platform->getSQLResultCasing('zip'), 'zip');
|
||||
@ -119,11 +124,11 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$rsm = new ResultSetMapping;
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addEntityResult(CmsUser::class, 'u');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('id'), 'id');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('name'), 'name');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('status'), 'status');
|
||||
$rsm->addJoinedEntityResult('Doctrine\Tests\Models\CMS\CmsPhonenumber', 'p', 'u', 'phonenumbers');
|
||||
$rsm->addJoinedEntityResult(CmsPhonenumber::class, 'p', 'u', 'phonenumbers');
|
||||
$rsm->addFieldResult('p', $this->platform->getSQLResultCasing('phonenumber'), 'phonenumber');
|
||||
|
||||
$query = $this->_em->createNativeQuery('SELECT id, name, status, phonenumber FROM cms_users INNER JOIN cms_phonenumbers ON id = user_id WHERE username = ?', $rsm);
|
||||
@ -131,9 +136,9 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
|
||||
$users = $query->getResult();
|
||||
$this->assertEquals(1, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertEquals('Roman', $users[0]->name);
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $users[0]->getPhonenumbers());
|
||||
$this->assertTrue($users[0]->getPhonenumbers()->isInitialized());
|
||||
$this->assertEquals(1, count($users[0]->getPhonenumbers()));
|
||||
$phones = $users[0]->getPhonenumbers();
|
||||
@ -164,11 +169,11 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
|
||||
|
||||
$rsm = new ResultSetMapping;
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addEntityResult(CmsUser::class, 'u');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('id'), 'id');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('name'), 'name');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('status'), 'status');
|
||||
$rsm->addJoinedEntityResult('Doctrine\Tests\Models\CMS\CmsAddress', 'a', 'u', 'address');
|
||||
$rsm->addJoinedEntityResult(CmsAddress::class, 'a', 'u', 'address');
|
||||
$rsm->addFieldResult('a', $this->platform->getSQLResultCasing('a_id'), 'id');
|
||||
$rsm->addFieldResult('a', $this->platform->getSQLResultCasing('country'), 'country');
|
||||
$rsm->addFieldResult('a', $this->platform->getSQLResultCasing('zip'), 'zip');
|
||||
@ -180,11 +185,11 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$users = $query->getResult();
|
||||
|
||||
$this->assertEquals(1, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertEquals('Roman', $users[0]->name);
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $users[0]->getPhonenumbers());
|
||||
$this->assertFalse($users[0]->getPhonenumbers()->isInitialized());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $users[0]->getAddress());
|
||||
$this->assertInstanceOf(CmsAddress::class, $users[0]->getAddress());
|
||||
$this->assertTrue($users[0]->getAddress()->getUser() == $users[0]);
|
||||
$this->assertEquals('germany', $users[0]->getAddress()->getCountry());
|
||||
$this->assertEquals(10827, $users[0]->getAddress()->getZipCode());
|
||||
@ -230,16 +235,16 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addJoinedEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber', 'p', 'u', 'phonenumbers');
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u');
|
||||
$rsm->addJoinedEntityFromClassMetadata(CmsPhonenumber::class, 'p', 'u', 'phonenumbers');
|
||||
$query = $this->_em->createNativeQuery('SELECT u.*, p.* FROM cms_users u LEFT JOIN cms_phonenumbers p ON u.id = p.user_id WHERE username = ?', $rsm);
|
||||
$query->setParameter(1, 'romanb');
|
||||
|
||||
$users = $query->getResult();
|
||||
$this->assertEquals(1, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertEquals('Roman', $users[0]->name);
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $users[0]->getPhonenumbers());
|
||||
$this->assertTrue($users[0]->getPhonenumbers()->isInitialized());
|
||||
$this->assertEquals(1, count($users[0]->getPhonenumbers()));
|
||||
$phones = $users[0]->getPhonenumbers();
|
||||
@ -249,7 +254,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber', 'p');
|
||||
$rsm->addRootEntityFromClassMetadata(CmsPhonenumber::class, 'p');
|
||||
$query = $this->_em->createNativeQuery('SELECT p.* FROM cms_phonenumbers p WHERE p.phonenumber = ?', $rsm);
|
||||
$query->setParameter(1, $phone->phonenumber);
|
||||
$phone = $query->getSingleResult();
|
||||
@ -280,8 +285,8 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
|
||||
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addJoinedEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', 'a', 'u', 'address', ['id' => 'a_id']
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u');
|
||||
$rsm->addJoinedEntityFromClassMetadata(CmsAddress::class, 'a', 'u', 'address', ['id' => 'a_id']
|
||||
);
|
||||
|
||||
$query = $this->_em->createNativeQuery('SELECT u.*, a.*, a.id AS a_id FROM cms_users u INNER JOIN cms_addresses a ON u.id = a.user_id WHERE u.username = ?', $rsm);
|
||||
@ -290,11 +295,11 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$users = $query->getResult();
|
||||
|
||||
$this->assertEquals(1, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertEquals('Roman', $users[0]->name);
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $users[0]->getPhonenumbers());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $users[0]->getPhonenumbers());
|
||||
$this->assertFalse($users[0]->getPhonenumbers()->isInitialized());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $users[0]->getAddress());
|
||||
$this->assertInstanceOf(CmsAddress::class, $users[0]->getAddress());
|
||||
$this->assertTrue($users[0]->getAddress()->getUser() == $users[0]);
|
||||
$this->assertEquals('germany', $users[0]->getAddress()->getCountry());
|
||||
$this->assertEquals(10827, $users[0]->getAddress()->getZipCode());
|
||||
@ -303,7 +308,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', 'a');
|
||||
$rsm->addRootEntityFromClassMetadata(CmsAddress::class, 'a');
|
||||
$query = $this->_em->createNativeQuery('SELECT a.* FROM cms_addresses a WHERE a.id = ?', $rsm);
|
||||
$query->setParameter(1, $addr->getId());
|
||||
$address = $query->getSingleResult();
|
||||
@ -318,7 +323,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testConcreteClassInSingleTableInheritanceSchemaWithRSMBuilderIsFine()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\Company\CompanyFixContract', 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(CompanyFixContract::class, 'c');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,7 +335,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->expectExceptionMessage('ResultSetMapping builder does not currently support your inheritance scheme.');
|
||||
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\Company\CompanyContract', 'c');
|
||||
$rsm->addRootEntityFromClassMetadata(CompanyContract::class, 'c');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -339,8 +344,8 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testRSMBuilderThrowsExceptionOnColumnConflict()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addJoinedEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', 'a', 'u', 'address');
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u');
|
||||
$rsm->addJoinedEntityFromClassMetadata(CmsAddress::class, 'a', 'u', 'address');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -349,8 +354,8 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testUnknownParentAliasThrowsException()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addJoinedEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress', 'a', 'un', 'address', ['id' => 'a_id']
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u');
|
||||
$rsm->addJoinedEntityFromClassMetadata(CmsAddress::class, 'a', 'un', 'address', ['id' => 'a_id']
|
||||
);
|
||||
|
||||
$query = $this->_em->createNativeQuery('SELECT u.*, a.*, a.id AS a_id FROM cms_users u INNER JOIN cms_addresses a ON u.id = a.user_id WHERE u.username = ?', $rsm);
|
||||
@ -387,12 +392,12 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$repository = $this->_em->getRepository(CmsAddress::class);
|
||||
$query = $repository->createNativeNamedQuery('find-all');
|
||||
$result = $query->getResult();
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $result[0]);
|
||||
$this->assertInstanceOf(CmsAddress::class, $result[0]);
|
||||
$this->assertEquals($addr->id, $result[0]->id);
|
||||
$this->assertEquals($addr->city, $result[0]->city);
|
||||
$this->assertEquals($addr->country, $result[0]->country);
|
||||
@ -419,14 +424,14 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
|
||||
$result = $repository->createNativeNamedQuery('fetchIdAndUsernameWithResultClass')
|
||||
->setParameter(1, 'FabioBatSilva')->getResult();
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[0]);
|
||||
$this->assertNull($result[0]->name);
|
||||
$this->assertNull($result[0]->email);
|
||||
$this->assertEquals($user->id, $result[0]->id);
|
||||
@ -439,12 +444,12 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
->setParameter(1, 'FabioBatSilva')->getResult();
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[0]);
|
||||
$this->assertEquals($user->id, $result[0]->id);
|
||||
$this->assertEquals('Fabio B. Silva', $result[0]->name);
|
||||
$this->assertEquals('FabioBatSilva', $result[0]->username);
|
||||
$this->assertEquals('dev', $result[0]->status);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsEmail', $result[0]->email);
|
||||
$this->assertInstanceOf(CmsEmail::class, $result[0]->email);
|
||||
}
|
||||
|
||||
|
||||
@ -471,18 +476,18 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
|
||||
$result = $repository->createNativeNamedQuery('fetchJoinedAddress')
|
||||
->setParameter(1, 'FabioBatSilva')->getResult();
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[0]);
|
||||
$this->assertEquals('Fabio B. Silva', $result[0]->name);
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0]->getPhonenumbers());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $result[0]->getPhonenumbers());
|
||||
$this->assertFalse($result[0]->getPhonenumbers()->isInitialized());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $result[0]->getAddress());
|
||||
$this->assertInstanceOf(CmsAddress::class, $result[0]->getAddress());
|
||||
$this->assertTrue($result[0]->getAddress()->getUser() == $result[0]);
|
||||
$this->assertEquals('Brazil', $result[0]->getAddress()->getCountry());
|
||||
$this->assertEquals(10827, $result[0]->getAddress()->getZipCode());
|
||||
@ -509,15 +514,15 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$result = $repository->createNativeNamedQuery('fetchJoinedPhonenumber')
|
||||
->setParameter(1, 'FabioBatSilva')->getResult();
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[0]);
|
||||
$this->assertEquals('Fabio B. Silva', $result[0]->name);
|
||||
$this->assertInstanceOf('Doctrine\ORM\PersistentCollection', $result[0]->getPhonenumbers());
|
||||
$this->assertInstanceOf(PersistentCollection::class, $result[0]->getPhonenumbers());
|
||||
$this->assertTrue($result[0]->getPhonenumbers()->isInitialized());
|
||||
$this->assertEquals(1, count($result[0]->getPhonenumbers()));
|
||||
$phones = $result[0]->getPhonenumbers();
|
||||
@ -557,7 +562,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
|
||||
$result = $repository->createNativeNamedQuery('fetchUserPhonenumberCount')
|
||||
->setParameter(1, ['test','FabioBatSilva'])->getResult();
|
||||
@ -567,12 +572,12 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->assertTrue(is_array($result[1]));
|
||||
|
||||
// first user => 2 phonenumbers
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[0][0]);
|
||||
$this->assertEquals('Fabio B. Silva', $result[0][0]->name);
|
||||
$this->assertEquals(2, $result[0]['numphones']);
|
||||
|
||||
// second user => 1 phonenumbers
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[1][0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[1][0]);
|
||||
$this->assertEquals('test tester', $result[1][0]->name);
|
||||
$this->assertEquals(1, $result[1]['numphones']);
|
||||
}
|
||||
@ -596,14 +601,14 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyPerson');
|
||||
$repository = $this->_em->getRepository(CompanyPerson::class);
|
||||
|
||||
$result = $repository->createNativeNamedQuery('fetchAllWithSqlResultSetMapping')
|
||||
->getResult();
|
||||
|
||||
$this->assertEquals(2, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $result[1]);
|
||||
$this->assertInstanceOf(CompanyPerson::class, $result[0]);
|
||||
$this->assertInstanceOf(CompanyEmployee::class, $result[1]);
|
||||
$this->assertTrue(is_numeric($result[0]->getId()));
|
||||
$this->assertTrue(is_numeric($result[1]->getId()));
|
||||
$this->assertEquals('Fabio B. Silva', $result[0]->getName());
|
||||
@ -617,8 +622,8 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
->getResult();
|
||||
|
||||
$this->assertEquals(2, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyPerson', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\Company\CompanyEmployee', $result[1]);
|
||||
$this->assertInstanceOf(CompanyPerson::class, $result[0]);
|
||||
$this->assertInstanceOf(CompanyEmployee::class, $result[1]);
|
||||
$this->assertTrue(is_numeric($result[0]->getId()));
|
||||
$this->assertTrue(is_numeric($result[1]->getId()));
|
||||
$this->assertEquals('Fabio B. Silva', $result[0]->getName());
|
||||
@ -657,7 +662,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$repository = $this->_em->getRepository(CmsUser::class);
|
||||
$query = $repository->createNativeNamedQuery('fetchMultipleJoinsEntityResults');
|
||||
$result = $query->getResult();
|
||||
|
||||
@ -665,9 +670,9 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertTrue(is_array($result[0]));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[0][0]);
|
||||
$this->assertEquals('Fabio B. Silva', $result[0][0]->name);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $result[0][0]->getAddress());
|
||||
$this->assertInstanceOf(CmsAddress::class, $result[0][0]->getAddress());
|
||||
$this->assertTrue($result[0][0]->getAddress()->getUser() == $result[0][0]);
|
||||
$this->assertEquals('Brazil', $result[0][0]->getAddress()->getCountry());
|
||||
$this->assertEquals(10827, $result[0][0]->getAddress()->getZipCode());
|
||||
@ -681,8 +686,8 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testNamedNativeQueryInheritance()
|
||||
{
|
||||
$contractMetadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\Company\CompanyContract');
|
||||
$flexMetadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\Company\CompanyFlexContract');
|
||||
$contractMetadata = $this->_em->getClassMetadata(CompanyContract::class);
|
||||
$flexMetadata = $this->_em->getClassMetadata(CompanyFlexContract::class);
|
||||
|
||||
$contractQueries = $contractMetadata->getNamedNativeQueries();
|
||||
$flexQueries = $flexMetadata->getNamedNativeQueries();
|
||||
@ -693,39 +698,39 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
|
||||
// contract queries
|
||||
$this->assertEquals('all-contracts', $contractQueries['all-contracts']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyContract', $contractQueries['all-contracts']['resultClass']);
|
||||
$this->assertEquals(CompanyContract::class, $contractQueries['all-contracts']['resultClass']);
|
||||
|
||||
$this->assertEquals('all', $contractQueries['all']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyContract', $contractQueries['all']['resultClass']);
|
||||
$this->assertEquals(CompanyContract::class, $contractQueries['all']['resultClass']);
|
||||
|
||||
|
||||
// flex contract queries
|
||||
$this->assertEquals('all-contracts', $flexQueries['all-contracts']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyFlexContract', $flexQueries['all-contracts']['resultClass']);
|
||||
$this->assertEquals(CompanyFlexContract::class, $flexQueries['all-contracts']['resultClass']);
|
||||
|
||||
$this->assertEquals('all-flex', $flexQueries['all-flex']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyFlexContract', $flexQueries['all-flex']['resultClass']);
|
||||
$this->assertEquals(CompanyFlexContract::class, $flexQueries['all-flex']['resultClass']);
|
||||
|
||||
$this->assertEquals('all', $flexQueries['all']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyFlexContract', $flexQueries['all']['resultClass']);
|
||||
$this->assertEquals(CompanyFlexContract::class, $flexQueries['all']['resultClass']);
|
||||
|
||||
|
||||
// contract result mapping
|
||||
$this->assertEquals('mapping-all-contracts', $contractMappings['mapping-all-contracts']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyContract', $contractMappings['mapping-all-contracts']['entities'][0]['entityClass']);
|
||||
$this->assertEquals(CompanyContract::class, $contractMappings['mapping-all-contracts']['entities'][0]['entityClass']);
|
||||
|
||||
$this->assertEquals('mapping-all', $contractMappings['mapping-all']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyContract', $contractMappings['mapping-all-contracts']['entities'][0]['entityClass']);
|
||||
$this->assertEquals(CompanyContract::class, $contractMappings['mapping-all-contracts']['entities'][0]['entityClass']);
|
||||
|
||||
// flex contract result mapping
|
||||
$this->assertEquals('mapping-all-contracts', $flexMappings['mapping-all-contracts']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyFlexContract', $flexMappings['mapping-all-contracts']['entities'][0]['entityClass']);
|
||||
$this->assertEquals(CompanyFlexContract::class, $flexMappings['mapping-all-contracts']['entities'][0]['entityClass']);
|
||||
|
||||
$this->assertEquals('mapping-all', $flexMappings['mapping-all']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyFlexContract', $flexMappings['mapping-all']['entities'][0]['entityClass']);
|
||||
$this->assertEquals(CompanyFlexContract::class, $flexMappings['mapping-all']['entities'][0]['entityClass']);
|
||||
|
||||
$this->assertEquals('mapping-all-flex', $flexMappings['mapping-all-flex']['name']);
|
||||
$this->assertEquals('Doctrine\Tests\Models\Company\CompanyFlexContract', $flexMappings['mapping-all-flex']['entities'][0]['entityClass']);
|
||||
$this->assertEquals(CompanyFlexContract::class, $flexMappings['mapping-all-flex']['entities'][0]['entityClass']);
|
||||
|
||||
}
|
||||
|
||||
@ -735,7 +740,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testGenerateSelectClauseNoRenameSingleEntity()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u');
|
||||
|
||||
$selectClause = $rsm->generateSelectClause();
|
||||
|
||||
@ -748,7 +753,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testGenerateSelectClauseCustomRenames()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u', [
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u', [
|
||||
'id' => 'id1',
|
||||
'username' => 'username2'
|
||||
]
|
||||
@ -765,7 +770,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testGenerateSelectClauseRenameTableAlias()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u');
|
||||
|
||||
$selectClause = $rsm->generateSelectClause(['u' => 'u1']);
|
||||
|
||||
@ -778,7 +783,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testGenerateSelectClauseIncrement()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em, ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u');
|
||||
|
||||
$selectClause = $rsm->generateSelectClause();
|
||||
|
||||
@ -791,7 +796,7 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testGenerateSelectClauseToString()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em, ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT);
|
||||
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u');
|
||||
$rsm->addRootEntityFromClassMetadata(CmsUser::class, 'u');
|
||||
|
||||
$this->assertSQLEquals('u.id AS id0, u.status AS status1, u.username AS username2, u.name AS name3, u.email_id AS email_id4', (string)$rsm);
|
||||
}
|
||||
@ -802,8 +807,8 @@ class NativeQueryTest extends OrmFunctionalTestCase
|
||||
public function testGenerateSelectClauseWithDiscriminatorColumn()
|
||||
{
|
||||
$rsm = new ResultSetMappingBuilder($this->_em, ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT);
|
||||
$rsm->addEntityResult('Doctrine\Tests\Models\DDC3899\DDC3899User', 'u');
|
||||
$rsm->addJoinedEntityResult('Doctrine\Tests\Models\DDC3899\DDC3899FixContract', 'c', 'u', 'contracts');
|
||||
$rsm->addEntityResult(DDC3899User::class, 'u');
|
||||
$rsm->addJoinedEntityResult(DDC3899FixContract::class, 'c', 'u', 'contracts');
|
||||
$rsm->addFieldResult('u', $this->platform->getSQLResultCasing('id'), 'id');
|
||||
$rsm->setDiscriminatorColumn('c', $this->platform->getSQLResultCasing('discr'));
|
||||
|
||||
|
@ -3,10 +3,12 @@
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\Tests\Models\CMS\CmsAddressDTO;
|
||||
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\Tests\Models\CMS\CmsUserDTO;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -122,9 +124,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]->name);
|
||||
@ -165,9 +167,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]->name);
|
||||
@ -201,9 +203,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
}
|
||||
|
||||
public function testShouldSupportFromEntityNamespaceAlias()
|
||||
@ -229,9 +231,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
}
|
||||
|
||||
public function testShouldSupportValueObjectNamespaceAlias()
|
||||
@ -257,9 +259,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
}
|
||||
|
||||
public function testShouldSupportLiteralExpression()
|
||||
@ -290,9 +292,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
||||
@ -338,9 +340,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
||||
@ -380,9 +382,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]->name);
|
||||
@ -440,9 +442,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]->name);
|
||||
@ -500,9 +502,9 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]->name);
|
||||
@ -558,13 +560,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2][0]);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0][1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1][1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2][1]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0][0]->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1][0]->name);
|
||||
@ -610,13 +612,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]['cmsUser']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0]['cmsAddress']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1]['cmsAddress']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2]['cmsAddress']);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]['cmsUser']->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]['cmsUser']->name);
|
||||
@ -662,13 +664,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]['cmsUser']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2][0]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]['cmsUser']->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]['cmsUser']->name);
|
||||
@ -715,13 +717,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2][0]);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0][1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1][1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2][1]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0][0]->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1][0]->name);
|
||||
@ -772,13 +774,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]['cmsUser']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0]['cmsAddress']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1]['cmsAddress']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2]['cmsAddress']);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]['cmsUser']->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]['cmsUser']->name);
|
||||
@ -829,13 +831,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]['cmsUser']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2][0]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]['cmsUser']->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]['cmsUser']->name);
|
||||
@ -887,13 +889,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1][0]);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2][0]);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0][1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1][1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1][1]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2][1]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0][0]->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1][0]->name);
|
||||
@ -949,13 +951,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]['cmsUser']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0]['cmsAddress']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1]['cmsAddress']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1]['cmsAddress']);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2]['cmsAddress']);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]['cmsUser']->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]['cmsUser']->name);
|
||||
@ -1011,13 +1013,13 @@ class NewOperatorTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[0]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[1]['cmsUser']);
|
||||
$this->assertInstanceOf(CmsUserDTO::class, $result[2]['cmsUser']);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[0][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[1][0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddressDTO', $result[2][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[0][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[1][0]);
|
||||
$this->assertInstanceOf(CmsAddressDTO::class, $result[2][0]);
|
||||
|
||||
$this->assertEquals($this->fixtures[0]->name, $result[0]['cmsUser']->name);
|
||||
$this->assertEquals($this->fixtures[1]->name, $result[1]['cmsUser']->name);
|
||||
|
@ -20,8 +20,8 @@ class NotifyPolicyTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\NotifyUser'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\NotifyGroup')
|
||||
$this->_em->getClassMetadata(NotifyUser::class),
|
||||
$this->_em->getClassMetadata(NotifyGroup::class)
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -57,9 +57,9 @@ class NotifyPolicyTest extends OrmFunctionalTestCase
|
||||
$groupId = $group->getId();
|
||||
unset($user, $group);
|
||||
|
||||
$user = $this->_em->find(__NAMESPACE__.'\NotifyUser', $userId);
|
||||
$user = $this->_em->find(NotifyUser::class, $userId);
|
||||
$this->assertEquals(1, $user->getGroups()->count());
|
||||
$group = $this->_em->find(__NAMESPACE__.'\NotifyGroup', $groupId);
|
||||
$group = $this->_em->find(NotifyGroup::class, $groupId);
|
||||
$this->assertEquals(1, $group->getUsers()->count());
|
||||
|
||||
$this->assertEquals(1, count($user->listeners));
|
||||
@ -82,11 +82,11 @@ class NotifyPolicyTest extends OrmFunctionalTestCase
|
||||
$group2Id = $group2->getId();
|
||||
unset($group2, $user);
|
||||
|
||||
$user = $this->_em->find(__NAMESPACE__.'\NotifyUser', $userId);
|
||||
$user = $this->_em->find(NotifyUser::class, $userId);
|
||||
$this->assertEquals(2, $user->getGroups()->count());
|
||||
$group2 = $this->_em->find(__NAMESPACE__.'\NotifyGroup', $group2Id);
|
||||
$group2 = $this->_em->find(NotifyGroup::class, $group2Id);
|
||||
$this->assertEquals(1, $group2->getUsers()->count());
|
||||
$group = $this->_em->find(__NAMESPACE__.'\NotifyGroup', $groupId);
|
||||
$group = $this->_em->find(NotifyGroup::class, $groupId);
|
||||
$this->assertEquals(1, $group->getUsers()->count());
|
||||
$this->assertEquals('geeks', $group->getName());
|
||||
}
|
||||
|
@ -2,9 +2,11 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceProduct;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceFeature;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceFeature;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceProduct;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -76,13 +78,13 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
$features = $product->getFeatures();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[0]);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $features[0]->getProduct());
|
||||
$this->assertInstanceOf(ECommerceFeature::class, $features[0]);
|
||||
$this->assertNotInstanceOf(Proxy::class, $features[0]->getProduct());
|
||||
$this->assertSame($product, $features[0]->getProduct());
|
||||
$this->assertEquals('Model writing tutorial', $features[0]->getDescription());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[1]);
|
||||
$this->assertInstanceOf(ECommerceFeature::class, $features[1]);
|
||||
$this->assertSame($product, $features[1]->getProduct());
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $features[1]->getProduct());
|
||||
$this->assertNotInstanceOf(Proxy::class, $features[1]->getProduct());
|
||||
$this->assertEquals('Annotations examples', $features[1]->getDescription());
|
||||
}
|
||||
|
||||
@ -96,11 +98,11 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
$features = $product->getFeatures();
|
||||
|
||||
$this->assertFalse($features->isInitialized());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[0]);
|
||||
$this->assertInstanceOf(ECommerceFeature::class, $features[0]);
|
||||
$this->assertTrue($features->isInitialized());
|
||||
$this->assertSame($product, $features[0]->getProduct());
|
||||
$this->assertEquals('Model writing tutorial', $features[0]->getDescription());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceFeature', $features[1]);
|
||||
$this->assertInstanceOf(ECommerceFeature::class, $features[1]);
|
||||
$this->assertSame($product, $features[1]->getProduct());
|
||||
$this->assertEquals('Annotations examples', $features[1]->getDescription());
|
||||
}
|
||||
@ -113,8 +115,8 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
$features = $query->getResult();
|
||||
|
||||
$product = $features[0]->getProduct();
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $product);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $product);
|
||||
$this->assertInstanceOf(Proxy::class, $product);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $product);
|
||||
$this->assertFalse($product->__isInitialized__);
|
||||
$this->assertSame('Doctrine Cookbook', $product->getName());
|
||||
$this->assertTrue($product->__isInitialized__);
|
||||
@ -129,8 +131,8 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
$features = $query->getResult();
|
||||
|
||||
$product = $features[0]->getProduct();
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $product);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $product);
|
||||
$this->assertNotInstanceOf(Proxy::class, $product);
|
||||
$this->assertInstanceOf(ECommerceProduct::class, $product);
|
||||
$this->assertSame('Doctrine Cookbook', $product->getName());
|
||||
|
||||
$this->assertFalse($product->getFeatures()->isInitialized());
|
||||
@ -157,19 +159,19 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->_createFixture();
|
||||
|
||||
$product = $this->_em->find('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $this->product->getId());
|
||||
$product = $this->_em->find(ECommerceProduct::class, $this->product->getId());
|
||||
$features = $product->getFeatures();
|
||||
|
||||
$results = $features->matching(new Criteria(
|
||||
Criteria::expr()->eq('description', 'Model writing tutorial')
|
||||
));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $results);
|
||||
$this->assertInstanceOf(Collection::class, $results);
|
||||
$this->assertEquals(1, count($results));
|
||||
|
||||
$results = $features->matching(new Criteria());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $results);
|
||||
$this->assertInstanceOf(Collection::class, $results);
|
||||
$this->assertEquals(2, count($results));
|
||||
}
|
||||
|
||||
@ -180,7 +182,7 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->_createFixture();
|
||||
|
||||
$product = $this->_em->find('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $this->product->getId());
|
||||
$product = $this->_em->find(ECommerceProduct::class, $this->product->getId());
|
||||
|
||||
$thirdFeature = new ECommerceFeature();
|
||||
$thirdFeature->setDescription('Model writing tutorial');
|
||||
@ -199,7 +201,7 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->_createFixture();
|
||||
|
||||
$product = $this->_em->find('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $this->product->getId());
|
||||
$product = $this->_em->find(ECommerceProduct::class, $this->product->getId());
|
||||
$features = $product->getFeatures();
|
||||
|
||||
$thirdFeature = new ECommerceFeature();
|
||||
@ -210,12 +212,12 @@ class OneToManyBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
Criteria::expr()->eq('description', 'Third feature')
|
||||
));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $results);
|
||||
$this->assertInstanceOf(Collection::class, $results);
|
||||
$this->assertCount(1, $results);
|
||||
|
||||
$results = $features->matching(new Criteria());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $results);
|
||||
$this->assertInstanceOf(Collection::class, $results);
|
||||
$this->assertCount(3, $results);
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\CMS\CmsUser,
|
||||
Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -42,7 +42,7 @@ class OneToManyOrphanRemovalTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testOrphanRemoval()
|
||||
{
|
||||
$userProxy = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$userProxy = $this->_em->getReference(CmsUser::class, $this->userId);
|
||||
|
||||
$this->_em->remove($userProxy);
|
||||
$this->_em->flush();
|
||||
@ -64,7 +64,7 @@ class OneToManyOrphanRemovalTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testOrphanRemovalRemoveFromCollection()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$phonenumber = $user->getPhonenumbers()->remove(0);
|
||||
|
||||
@ -82,7 +82,7 @@ class OneToManyOrphanRemovalTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testOrphanRemovalClearCollectionAndReAdd()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$phone1 = $user->getPhonenumbers()->first();
|
||||
|
||||
@ -102,7 +102,7 @@ class OneToManyOrphanRemovalTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testOrphanRemovalClearCollectionAndAddNew()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$newPhone = new CmsPhonenumber();
|
||||
|
||||
$newPhone->phonenumber = '654321';
|
||||
@ -123,7 +123,7 @@ class OneToManyOrphanRemovalTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testOrphanRemovalUnitializedCollection()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$user->phonenumbers->clear();
|
||||
$this->_em->flush();
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceCategory;
|
||||
use Doctrine\ORM\Mapping\AssociationMapping;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceCategory;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -78,10 +78,10 @@ class OneToManySelfReferentialAssociationTest extends OrmFunctionalTestCase
|
||||
$parent = $result[0];
|
||||
$children = $parent->getChildren();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[0]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $children[0]);
|
||||
$this->assertSame($parent, $children[0]->getParent());
|
||||
$this->assertEquals(' books', strstr($children[0]->getName(), ' books'));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[1]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $children[1]);
|
||||
$this->assertSame($parent, $children[1]->getParent());
|
||||
$this->assertEquals(' books', strstr($children[1]->getName(), ' books'));
|
||||
}
|
||||
@ -89,7 +89,7 @@ class OneToManySelfReferentialAssociationTest extends OrmFunctionalTestCase
|
||||
public function testLazyLoadsOneToManyAssociation()
|
||||
{
|
||||
$this->_createFixture();
|
||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceCategory');
|
||||
$metadata = $this->_em->getClassMetadata(ECommerceCategory::class);
|
||||
$metadata->associationMappings['children']['fetch'] = ClassMetadata::FETCH_LAZY;
|
||||
|
||||
$query = $this->_em->createQuery('select c from Doctrine\Tests\Models\ECommerce\ECommerceCategory c order by c.id asc');
|
||||
@ -97,10 +97,10 @@ class OneToManySelfReferentialAssociationTest extends OrmFunctionalTestCase
|
||||
$parent = $result[0];
|
||||
$children = $parent->getChildren();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[0]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $children[0]);
|
||||
$this->assertSame($parent, $children[0]->getParent());
|
||||
$this->assertEquals(' books', strstr($children[0]->getName(), ' books'));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCategory', $children[1]);
|
||||
$this->assertInstanceOf(ECommerceCategory::class, $children[1]);
|
||||
$this->assertSame($parent, $children[1]->getParent());
|
||||
$this->assertEquals(' books', strstr($children[1]->getName(), ' books'));
|
||||
}
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceCart;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceCustomer;
|
||||
use Doctrine\ORM\Mapping\AssociationMapping;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceCart;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceCustomer;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -61,27 +62,27 @@ class OneToOneBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
$result = $query->getResult();
|
||||
$customer = $result[0];
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $customer->getCart());
|
||||
$this->assertInstanceOf(ECommerceCart::class, $customer->getCart());
|
||||
$this->assertEquals('paypal', $customer->getCart()->getPayment());
|
||||
}
|
||||
|
||||
public function testLazyLoadsObjectsOnTheOwningSide() {
|
||||
$this->_createFixture();
|
||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceCart');
|
||||
$metadata = $this->_em->getClassMetadata(ECommerceCart::class);
|
||||
$metadata->associationMappings['customer']['fetchMode'] = ClassMetadata::FETCH_LAZY;
|
||||
|
||||
$query = $this->_em->createQuery('select c from Doctrine\Tests\Models\ECommerce\ECommerceCart c');
|
||||
$result = $query->getResult();
|
||||
$cart = $result[0];
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $cart->getCustomer());
|
||||
$this->assertInstanceOf(ECommerceCustomer::class, $cart->getCustomer());
|
||||
$this->assertEquals('Giorgio', $cart->getCustomer()->getName());
|
||||
}
|
||||
|
||||
public function testInverseSideIsNeverLazy()
|
||||
{
|
||||
$this->_createFixture();
|
||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceCustomer');
|
||||
$metadata = $this->_em->getClassMetadata(ECommerceCustomer::class);
|
||||
$metadata->associationMappings['mentor']['fetch'] = ClassMetadata::FETCH_EAGER;
|
||||
|
||||
$query = $this->_em->createQuery('select c from Doctrine\Tests\Models\ECommerce\ECommerceCustomer c');
|
||||
@ -89,8 +90,8 @@ class OneToOneBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
$customer = $result[0];
|
||||
|
||||
$this->assertNull($customer->getMentor());
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $customer->getCart());
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $customer->getCart());
|
||||
$this->assertInstanceOf(ECommerceCart::class, $customer->getCart());
|
||||
$this->assertNotInstanceOf(Proxy::class, $customer->getCart());
|
||||
$this->assertEquals('paypal', $customer->getCart()->getPayment());
|
||||
}
|
||||
|
||||
@ -106,7 +107,7 @@ class OneToOneBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCart', $cust->getCart());
|
||||
$this->assertInstanceOf(ECommerceCart::class, $cust->getCart());
|
||||
$this->assertEquals('Roman', $cust->getName());
|
||||
$this->assertSame($cust, $cart->getCustomer());
|
||||
|
||||
@ -125,7 +126,7 @@ class OneToOneBidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
$cart3 = $query2->getSingleResult();
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $cart3->getCustomer());
|
||||
$this->assertInstanceOf(ECommerceCustomer::class, $cart3->getCustomer());
|
||||
$this->assertEquals('Roman', $cart3->getCustomer()->getName());
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
@ -17,11 +18,11 @@ class OneToOneEagerLoadingTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Train'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\TrainDriver'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\TrainOwner'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\Waggon'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\TrainOrder'),
|
||||
$this->_em->getClassMetadata(Train::class),
|
||||
$this->_em->getClassMetadata(TrainDriver::class),
|
||||
$this->_em->getClassMetadata(TrainOwner::class),
|
||||
$this->_em->getClassMetadata(Waggon::class),
|
||||
$this->_em->getClassMetadata(TrainOrder::class),
|
||||
]
|
||||
);
|
||||
} catch(\Exception $e) {}
|
||||
@ -46,7 +47,7 @@ class OneToOneEagerLoadingTest extends OrmFunctionalTestCase
|
||||
$sqlCount = count($this->_sqlLoggerStack->queries);
|
||||
|
||||
$train = $this->_em->find(get_class($train), $train->id);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $train->driver);
|
||||
$this->assertNotInstanceOf(Proxy::class, $train->driver);
|
||||
$this->assertEquals("Benjamin", $train->driver->name);
|
||||
|
||||
$this->assertEquals($sqlCount + 1, count($this->_sqlLoggerStack->queries));
|
||||
@ -66,7 +67,7 @@ class OneToOneEagerLoadingTest extends OrmFunctionalTestCase
|
||||
$sqlCount = count($this->_sqlLoggerStack->queries);
|
||||
|
||||
$train = $this->_em->find(get_class($train), $train->id);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $train->driver);
|
||||
$this->assertNotInstanceOf(Proxy::class, $train->driver);
|
||||
$this->assertNull($train->driver);
|
||||
|
||||
$this->assertEquals($sqlCount + 1, count($this->_sqlLoggerStack->queries));
|
||||
@ -87,7 +88,7 @@ class OneToOneEagerLoadingTest extends OrmFunctionalTestCase
|
||||
$sqlCount = count($this->_sqlLoggerStack->queries);
|
||||
|
||||
$driver = $this->_em->find(get_class($owner), $owner->id);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $owner->train);
|
||||
$this->assertNotInstanceOf(Proxy::class, $owner->train);
|
||||
$this->assertNotNull($owner->train);
|
||||
|
||||
$this->assertEquals($sqlCount + 1, count($this->_sqlLoggerStack->queries));
|
||||
@ -109,7 +110,7 @@ class OneToOneEagerLoadingTest extends OrmFunctionalTestCase
|
||||
$sqlCount = count($this->_sqlLoggerStack->queries);
|
||||
|
||||
$driver = $this->_em->find(get_class($driver), $driver->id);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $driver->train);
|
||||
$this->assertNotInstanceOf(Proxy::class, $driver->train);
|
||||
$this->assertNull($driver->train);
|
||||
|
||||
$this->assertEquals($sqlCount + 1, count($this->_sqlLoggerStack->queries));
|
||||
@ -126,7 +127,7 @@ class OneToOneEagerLoadingTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$waggon = $this->_em->find(get_class($waggon), $waggon->id);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $waggon->train);
|
||||
$this->assertNotInstanceOf(Proxy::class, $waggon->train);
|
||||
$this->assertNotNull($waggon->train);
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\CMS\CmsUser,
|
||||
Doctrine\Tests\Models\CMS\CmsEmail,
|
||||
Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
use Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
use Doctrine\Tests\Models\CMS\CmsEmail;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -40,7 +40,7 @@ class OneToOneOrphanRemovalTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$userProxy = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
$userProxy = $this->_em->getReference(CmsUser::class, $userId);
|
||||
|
||||
$this->_em->remove($userProxy);
|
||||
$this->_em->flush();
|
||||
@ -76,7 +76,7 @@ class OneToOneOrphanRemovalTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
$user = $this->_em->find(CmsUser::class, $userId);
|
||||
|
||||
$user->setEmail(null);
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceCustomer;
|
||||
use Doctrine\ORM\Mapping\AssociationMapping;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceCustomer;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -52,8 +53,8 @@ class OneToOneSelfReferentialAssociationTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->_createFixture();
|
||||
|
||||
$customer = $this->_em->find('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $id);
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $customer->getMentor());
|
||||
$customer = $this->_em->find(ECommerceCustomer::class, $id);
|
||||
$this->assertNotInstanceOf(Proxy::class, $customer->getMentor());
|
||||
}
|
||||
|
||||
public function testEagerLoadsAssociation()
|
||||
@ -74,7 +75,7 @@ class OneToOneSelfReferentialAssociationTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->_createFixture();
|
||||
|
||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceCustomer');
|
||||
$metadata = $this->_em->getClassMetadata(ECommerceCustomer::class);
|
||||
$metadata->associationMappings['mentor']['fetch'] = ClassMetadata::FETCH_LAZY;
|
||||
|
||||
$query = $this->_em->createQuery("select c from Doctrine\Tests\Models\ECommerce\ECommerceCustomer c where c.name='Luke Skywalker'");
|
||||
@ -88,7 +89,7 @@ class OneToOneSelfReferentialAssociationTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\MultiSelfReference')
|
||||
$this->_em->getClassMetadata(MultiSelfReference::class)
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -105,8 +106,8 @@ class OneToOneSelfReferentialAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
$entity2 = $this->_em->find(get_class($entity1), $entity1->getId());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\MultiSelfReference', $entity2->getOther1());
|
||||
$this->assertInstanceOf('Doctrine\Tests\ORM\Functional\MultiSelfReference', $entity2->getOther2());
|
||||
$this->assertInstanceOf(MultiSelfReference::class, $entity2->getOther1());
|
||||
$this->assertInstanceOf(MultiSelfReference::class, $entity2->getOther2());
|
||||
$this->assertNull($entity2->getOther1()->getOther1());
|
||||
$this->assertNull($entity2->getOther1()->getOther2());
|
||||
$this->assertNull($entity2->getOther2()->getOther1());
|
||||
@ -115,7 +116,7 @@ class OneToOneSelfReferentialAssociationTest extends OrmFunctionalTestCase
|
||||
|
||||
public function assertLoadingOfAssociation($customer)
|
||||
{
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceCustomer', $customer->getMentor());
|
||||
$this->assertInstanceOf(ECommerceCustomer::class, $customer->getMentor());
|
||||
$this->assertEquals('Obi-wan Kenobi', $customer->getMentor()->getName());
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@ class OneToOneSingleTableInheritanceTest extends OrmFunctionalTestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(Pet::CLASSNAME),
|
||||
$this->_em->getClassMetadata(Cat::CLASSNAME),
|
||||
$this->_em->getClassMetadata(LitterBox::CLASSNAME),
|
||||
$this->_em->getClassMetadata(Pet::class),
|
||||
$this->_em->getClassMetadata(Cat::class),
|
||||
$this->_em->getClassMetadata(LitterBox::class),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -38,11 +38,11 @@ class OneToOneSingleTableInheritanceTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
/* @var $foundCat Cat */
|
||||
$foundCat = $this->_em->find(Pet::CLASSNAME, $cat->id);
|
||||
$foundCat = $this->_em->find(Pet::class, $cat->id);
|
||||
|
||||
$this->assertInstanceOf(Cat::CLASSNAME, $foundCat);
|
||||
$this->assertInstanceOf(Cat::class, $foundCat);
|
||||
$this->assertSame($cat->id, $foundCat->id);
|
||||
$this->assertInstanceOf(LitterBox::CLASSNAME, $foundCat->litterBox);
|
||||
$this->assertInstanceOf(LitterBox::class, $foundCat->litterBox);
|
||||
$this->assertSame($cat->litterBox->id, $foundCat->litterBox->id);
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
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\ECommerce\ECommerceProduct;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceShipping;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -55,20 +55,20 @@ class OneToOneUnidirectionalAssociationTest extends OrmFunctionalTestCase
|
||||
$result = $query->getResult();
|
||||
$product = $result[0];
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceShipping', $product->getShipping());
|
||||
$this->assertInstanceOf(ECommerceShipping::class, $product->getShipping());
|
||||
$this->assertEquals(1, $product->getShipping()->getDays());
|
||||
}
|
||||
|
||||
public function testLazyLoadsObjects() {
|
||||
$this->_createFixture();
|
||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceProduct');
|
||||
$metadata = $this->_em->getClassMetadata(ECommerceProduct::class);
|
||||
$metadata->associationMappings['shipping']['fetch'] = ClassMetadata::FETCH_LAZY;
|
||||
|
||||
$query = $this->_em->createQuery('select p from Doctrine\Tests\Models\ECommerce\ECommerceProduct p');
|
||||
$result = $query->getResult();
|
||||
$product = $result[0];
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\ECommerce\ECommerceShipping', $product->getShipping());
|
||||
$this->assertInstanceOf(ECommerceShipping::class, $product->getShipping());
|
||||
$this->assertEquals(1, $product->getShipping()->getDays());
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\Routing\RoutingRoute;
|
||||
use Doctrine\Tests\Models\Routing\RoutingLocation;
|
||||
use Doctrine\Tests\Models\Routing\RoutingLeg;
|
||||
use Doctrine\Tests\Models\Routing\RoutingLocation;
|
||||
use Doctrine\Tests\Models\Routing\RoutingRoute;
|
||||
use Doctrine\Tests\Models\Routing\RoutingRouteBooking;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
@ -59,7 +59,7 @@ class OrderedCollectionTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$routeId = $this->createPersistedRouteWithLegs();
|
||||
|
||||
$route = $this->_em->find('Doctrine\Tests\Models\Routing\RoutingRoute', $routeId);
|
||||
$route = $this->_em->find(RoutingRoute::class, $routeId);
|
||||
|
||||
$this->assertEquals(2, count($route->legs));
|
||||
$this->assertEquals("Berlin", $route->legs[0]->fromLocation->getName());
|
||||
@ -90,7 +90,7 @@ class OrderedCollectionTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$route = $this->_em->find('Doctrine\Tests\Models\Routing\RoutingRoute', $routeId);
|
||||
$route = $this->_em->find(RoutingRoute::class, $routeId);
|
||||
|
||||
$this->assertEquals(2, count($route->bookings));
|
||||
$this->assertEquals('Benjamin', $route->bookings[0]->getPassengerName());
|
||||
|
@ -18,9 +18,9 @@ class OrderedJoinedTableInheritanceCollectionTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\OJTIC_Pet'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\OJTIC_Cat'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\OJTIC_Dog'),
|
||||
$this->_em->getClassMetadata(OJTIC_Pet::class),
|
||||
$this->_em->getClassMetadata(OJTIC_Cat::class),
|
||||
$this->_em->getClassMetadata(OJTIC_Dog::class),
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
|
@ -3,11 +3,11 @@
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||
use Doctrine\Tests\Models\CMS\CmsArticle;
|
||||
use Doctrine\Tests\Models\CMS\CmsEmail;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\CMS\CmsGroup;
|
||||
use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\Company\CompanyManager;
|
||||
use Doctrine\Tests\Models\Pagination\Company;
|
||||
use Doctrine\Tests\Models\Pagination\Department;
|
||||
@ -595,7 +595,7 @@ class PaginationTest extends OrmFunctionalTestCase
|
||||
|
||||
// If the Paginator detects the custom output walker it should fall back to using the
|
||||
// Tree walkers for pagination, which leads to an exception. If the query works, the output walkers were used
|
||||
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Query\SqlWalker');
|
||||
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, Query\SqlWalker::class);
|
||||
$paginator = new Paginator($query);
|
||||
|
||||
$this->expectException(\RuntimeException::class);
|
||||
@ -633,8 +633,7 @@ class PaginationTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$dql = 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u';
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, ['Doctrine\Tests\ORM\Functional\CustomPaginationTestTreeWalker']
|
||||
);
|
||||
$query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, [CustomPaginationTestTreeWalker::class]);
|
||||
|
||||
$paginator = new Paginator($query, true);
|
||||
$paginator->setUseOutputWalkers(false);
|
||||
@ -662,7 +661,7 @@ class PaginationTest extends OrmFunctionalTestCase
|
||||
$this->assertCount(2, $getCountQuery->invoke($paginator)->getParameters());
|
||||
$this->assertCount(9, $paginator);
|
||||
|
||||
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Query\SqlWalker');
|
||||
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, Query\SqlWalker::class);
|
||||
|
||||
$paginator = new Paginator($query);
|
||||
|
||||
|
@ -3,9 +3,11 @@
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\LazyCriteriaCollection;
|
||||
use Doctrine\Tests\Models\Quote\Group;
|
||||
use Doctrine\Tests\Models\Quote\User as QuoteUser;
|
||||
use Doctrine\Tests\Models\Tweet\Tweet;
|
||||
use Doctrine\Tests\Models\Tweet\User;
|
||||
use Doctrine\Tests\Models\Tweet\User as TweetUser;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
@ -73,12 +75,12 @@ class PersistentCollectionCriteriaTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadTweetFixture();
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\Tweet\User');
|
||||
$repository = $this->_em->getRepository(User::class);
|
||||
|
||||
$user = $repository->findOneBy(['name' => 'ngal']);
|
||||
$tweets = $user->tweets->matching(new Criteria());
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\LazyCriteriaCollection', $tweets);
|
||||
$this->assertInstanceOf(LazyCriteriaCollection::class, $tweets);
|
||||
$this->assertFalse($tweets->isInitialized());
|
||||
$this->assertCount(2, $tweets);
|
||||
$this->assertFalse($tweets->isInitialized());
|
||||
@ -88,7 +90,7 @@ class PersistentCollectionCriteriaTest extends OrmFunctionalTestCase
|
||||
Criteria::expr()->eq('content', 'Foo')
|
||||
));
|
||||
|
||||
$this->assertInstanceOf('Doctrine\ORM\LazyCriteriaCollection', $tweets);
|
||||
$this->assertInstanceOf(LazyCriteriaCollection::class, $tweets);
|
||||
$this->assertFalse($tweets->isInitialized());
|
||||
$this->assertCount(1, $tweets);
|
||||
$this->assertFalse($tweets->isInitialized());
|
||||
|
@ -15,8 +15,8 @@ class PersistentCollectionTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\PersistentCollectionHolder'),
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\PersistentCollectionContent'),
|
||||
$this->_em->getClassMetadata(PersistentCollectionHolder::class),
|
||||
$this->_em->getClassMetadata(PersistentCollectionContent::class),
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -35,7 +35,7 @@ class PersistentCollectionTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$collectionHolder = $this->_em->find(__NAMESPACE__ . '\PersistentCollectionHolder', $collectionHolder->getId());
|
||||
$collectionHolder = $this->_em->find(PersistentCollectionHolder::class, $collectionHolder->getId());
|
||||
$collectionHolder->getCollection();
|
||||
|
||||
$content = new PersistentCollectionContent('second element');
|
||||
@ -55,7 +55,7 @@ class PersistentCollectionTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$collectionHolder = $this->_em->find(__NAMESPACE__ . '\PersistentCollectionHolder', $collectionHolder->getId());
|
||||
$collectionHolder = $this->_em->find(PersistentCollectionHolder::class, $collectionHolder->getId());
|
||||
$collection = $collectionHolder->getRawCollection();
|
||||
|
||||
$this->assertTrue($collection->isEmpty());
|
||||
@ -66,7 +66,7 @@ class PersistentCollectionTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$collectionHolder = $this->_em->find(__NAMESPACE__ . '\PersistentCollectionHolder', $collectionHolder->getId());
|
||||
$collectionHolder = $this->_em->find(PersistentCollectionHolder::class, $collectionHolder->getId());
|
||||
$collection = $collectionHolder->getRawCollection();
|
||||
|
||||
$this->assertFalse($collection->isEmpty());
|
||||
@ -87,7 +87,7 @@ class PersistentCollectionTest extends OrmFunctionalTestCase
|
||||
|
||||
$criteria = new Criteria();
|
||||
|
||||
$collectionHolder = $this->_em->find(__NAMESPACE__ . '\PersistentCollectionHolder', $collectionHolder->getId());
|
||||
$collectionHolder = $this->_em->find(PersistentCollectionHolder::class, $collectionHolder->getId());
|
||||
$collectionHolder->getCollection()->matching($criteria);
|
||||
|
||||
$this->assertEmpty($criteria->getWhereExpression());
|
||||
|
@ -19,7 +19,7 @@ class PersistentObjectTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\PersistentEntity'),
|
||||
$this->_em->getClassMetadata(PersistentEntity::class),
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -46,7 +46,7 @@ class PersistentObjectTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$entity = $this->_em->find(__NAMESPACE__ . '\PersistentEntity', $entity->getId());
|
||||
$entity = $this->_em->find(PersistentEntity::class, $entity->getId());
|
||||
|
||||
$this->assertEquals('test', $entity->getName());
|
||||
$entity->setName('foobar');
|
||||
@ -63,7 +63,7 @@ class PersistentObjectTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$entity = $this->_em->getReference(__NAMESPACE__ . '\PersistentEntity', $entity->getId());
|
||||
$entity = $this->_em->getReference(PersistentEntity::class, $entity->getId());
|
||||
|
||||
$this->assertEquals('test', $entity->getName());
|
||||
}
|
||||
@ -78,7 +78,7 @@ class PersistentObjectTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$entity = $this->_em->getReference(__NAMESPACE__ . '\PersistentEntity', $entity->getId());
|
||||
$entity = $this->_em->getReference(PersistentEntity::class, $entity->getId());
|
||||
$this->assertSame($entity, $entity->getParent());
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Util\ClassUtils;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
use Doctrine\Tests\Models\CMS\CmsEmail;
|
||||
use Doctrine\ORM\Event\LifecycleEventArgs;
|
||||
use Doctrine\ORM\Events;
|
||||
use Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
use Doctrine\Tests\Models\CMS\CmsEmail;
|
||||
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -48,7 +48,7 @@ class PostLoadEventTest extends OrmFunctionalTestCase
|
||||
|
||||
$eventManager->addEventListener([Events::postLoad], $mockListener);
|
||||
|
||||
$this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$this->_em->find(CmsUser::class, $this->userId);
|
||||
}
|
||||
|
||||
public function testLoadedEntityUsingQueryShouldTriggerEvent()
|
||||
@ -125,7 +125,7 @@ class PostLoadEventTest extends OrmFunctionalTestCase
|
||||
|
||||
$eventManager->addEventListener([Events::postLoad], $mockListener);
|
||||
|
||||
$userProxy = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$userProxy = $this->_em->getReference(CmsUser::class, $this->userId);
|
||||
|
||||
// Now deactivate original listener and attach new one
|
||||
$eventManager->removeEventListener([Events::postLoad], $mockListener);
|
||||
@ -165,7 +165,7 @@ class PostLoadEventTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testLoadedProxyAssociationToOneShouldTriggerEvent()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$mockListener = $this->createMock(PostLoadListener::class);
|
||||
|
||||
@ -186,7 +186,7 @@ class PostLoadEventTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testLoadedProxyAssociationToManyShouldTriggerEvent()
|
||||
{
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$mockListener = $this->createMock(PostLoadListener::class);
|
||||
|
||||
@ -213,7 +213,7 @@ class PostLoadEventTest extends OrmFunctionalTestCase
|
||||
$checkerListener = new PostLoadListenerCheckAssociationsArePopulated();
|
||||
$this->_em->getEventManager()->addEventListener([Events::postLoad], $checkerListener);
|
||||
|
||||
$qb = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->createQueryBuilder('u');
|
||||
$qb = $this->_em->getRepository(CmsUser::class)->createQueryBuilder('u');
|
||||
$qb->leftJoin('u.email', 'email');
|
||||
$qb->addSelect('email');
|
||||
$qb->getQuery()->getSingleResult();
|
||||
@ -231,9 +231,9 @@ class PostLoadEventTest extends OrmFunctionalTestCase
|
||||
$listener = new PostLoadListenerLoadEntityInEventHandler();
|
||||
$eventManager->addEventListener([Events::postLoad], $listener);
|
||||
|
||||
$this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$this->assertSame(1, $listener->countHandledEvents('Doctrine\Tests\Models\CMS\CmsUser'), 'Doctrine\Tests\Models\CMS\CmsUser should be handled once!');
|
||||
$this->assertSame(1, $listener->countHandledEvents('Doctrine\Tests\Models\CMS\CmsEmail'), '\Doctrine\Tests\Models\CMS\CmsEmail should be handled once!');
|
||||
$this->_em->find(CmsUser::class, $this->userId);
|
||||
$this->assertSame(1, $listener->countHandledEvents(CmsUser::class), CmsUser::class . ' should be handled once!');
|
||||
$this->assertSame(1, $listener->countHandledEvents(CmsEmail::class), CmsEmail::class . ' should be handled once!');
|
||||
}
|
||||
|
||||
private function loadFixture()
|
||||
|
@ -2,8 +2,15 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
use Doctrine\Tests\Models\CMS\CmsArticle;
|
||||
use Doctrine\Tests\Models\CMS\CmsEmail;
|
||||
use Doctrine\Tests\Models\CMS\CmsGroup;
|
||||
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
|
||||
use Doctrine\Tests\Models\CMS\CmsTag;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser as CmsUserProxy;
|
||||
|
||||
/**
|
||||
* Test that Doctrine ORM correctly works with proxy instances exactly like with ordinary Entities
|
||||
@ -26,12 +33,13 @@ class ProxiesLikeEntitiesTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsArticle'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsEmail'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsGroup'),
|
||||
$this->_em->getClassMetadata(CmsUser::class),
|
||||
$this->_em->getClassMetadata(CmsTag::class),
|
||||
$this->_em->getClassMetadata(CmsPhonenumber::class),
|
||||
$this->_em->getClassMetadata(CmsArticle::class),
|
||||
$this->_em->getClassMetadata(CmsAddress::class),
|
||||
$this->_em->getClassMetadata(CmsEmail::class),
|
||||
$this->_em->getClassMetadata(CmsGroup::class),
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
@ -50,7 +58,7 @@ class ProxiesLikeEntitiesTest extends OrmFunctionalTestCase
|
||||
public function testPersistUpdate()
|
||||
{
|
||||
// Considering case (a)
|
||||
$proxy = $this->_em->getProxyFactory()->getProxy('Doctrine\Tests\Models\CMS\CmsUser', ['id' => 123]);
|
||||
$proxy = $this->_em->getProxyFactory()->getProxy(CmsUser::class, ['id' => 123]);
|
||||
$proxy->__isInitialized__ = true;
|
||||
$proxy->id = null;
|
||||
$proxy->username = 'ocra';
|
||||
@ -59,12 +67,10 @@ class ProxiesLikeEntitiesTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->assertNotNull($proxy->getId());
|
||||
$proxy->name = 'Marco Pivetta';
|
||||
$this
|
||||
->_em
|
||||
->getUnitOfWork()
|
||||
->computeChangeSet($this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'), $proxy);
|
||||
$this->_em->getUnitOfWork()
|
||||
->computeChangeSet($this->_em->getClassMetadata(CmsUser::class), $proxy);
|
||||
$this->assertNotEmpty($this->_em->getUnitOfWork()->getEntityChangeSet($proxy));
|
||||
$this->assertEquals('Marco Pivetta', $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $proxy->getId())->name);
|
||||
$this->assertEquals('Marco Pivetta', $this->_em->find(CmsUser::class, $proxy->getId())->name);
|
||||
$this->_em->remove($proxy);
|
||||
$this->_em->flush();
|
||||
}
|
||||
@ -72,9 +78,9 @@ class ProxiesLikeEntitiesTest extends OrmFunctionalTestCase
|
||||
public function testEntityWithIdentifier()
|
||||
{
|
||||
$userId = $this->user->getId();
|
||||
/* @var $uninitializedProxy \Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser */
|
||||
$uninitializedProxy = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser', $uninitializedProxy);
|
||||
/* @var $uninitializedProxy CmsUserProxy */
|
||||
$uninitializedProxy = $this->_em->getReference(CmsUser::class, $userId);
|
||||
$this->assertInstanceOf(CmsUserProxy::class, $uninitializedProxy);
|
||||
|
||||
$this->_em->persist($uninitializedProxy);
|
||||
$this->_em->flush($uninitializedProxy);
|
||||
@ -89,7 +95,7 @@ class ProxiesLikeEntitiesTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testProxyAsDqlParameterPersist()
|
||||
{
|
||||
$proxy = $this->_em->getProxyFactory()->getProxy('Doctrine\Tests\Models\CMS\CmsUser', ['id' => $this->user->getId()]
|
||||
$proxy = $this->_em->getProxyFactory()->getProxy(CmsUser::class, ['id' => $this->user->getId()]
|
||||
);
|
||||
$proxy->id = $this->user->getId();
|
||||
$result = $this
|
||||
@ -107,27 +113,23 @@ class ProxiesLikeEntitiesTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testFindWithProxyName()
|
||||
{
|
||||
$result = $this
|
||||
->_em
|
||||
->find('Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser', $this->user->getId());
|
||||
$result = $this->_em->find(CmsUserProxy::class, $this->user->getId());
|
||||
$this->assertSame($this->user->getId(), $result->getId());
|
||||
$this->_em->clear();
|
||||
$result = $this
|
||||
->_em
|
||||
->getReference('Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser', $this->user->getId());
|
||||
|
||||
$result = $this->_em->getReference(CmsUserProxy::class, $this->user->getId());
|
||||
$this->assertSame($this->user->getId(), $result->getId());
|
||||
$this->_em->clear();
|
||||
$result = $this
|
||||
->_em
|
||||
->getRepository('Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser')
|
||||
->findOneBy(['username' => $this->user->username]);
|
||||
|
||||
$result = $this->_em->getRepository(CmsUserProxy::class)->findOneBy(['username' => $this->user->username]);
|
||||
$this->assertSame($this->user->getId(), $result->getId());
|
||||
$this->_em->clear();
|
||||
$result = $this
|
||||
->_em
|
||||
|
||||
$result = $this->_em
|
||||
->createQuery('SELECT u FROM Doctrine\Tests\Proxies\__CG__\Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1')
|
||||
->setParameter(1, $this->user->getId())
|
||||
->getSingleResult();
|
||||
|
||||
$this->assertSame($this->user->getId(), $result->getId());
|
||||
$this->_em->clear();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class QueryCacheTest extends OrmFunctionalTestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->cacheDataReflection = new \ReflectionProperty("Doctrine\Common\Cache\ArrayCache", "data");
|
||||
$this->cacheDataReflection = new \ReflectionProperty(ArrayCache::class, "data");
|
||||
$this->cacheDataReflection->setAccessible(true);
|
||||
|
||||
$this->useModelSet('cms');
|
||||
@ -116,7 +116,7 @@ class QueryCacheTest extends OrmFunctionalTestCase
|
||||
$cache
|
||||
->expects(self::once())
|
||||
->method('save')
|
||||
->with(self::isType('string'), self::isInstanceOf('Doctrine\ORM\Query\ParserResult'));
|
||||
->with(self::isType('string'), self::isInstanceOf(ParserResult::class));
|
||||
|
||||
$query->getResult();
|
||||
}
|
||||
@ -151,6 +151,7 @@ class QueryCacheTest extends OrmFunctionalTestCase
|
||||
->method('doFetch')
|
||||
->with($this->isType('string'))
|
||||
->will($this->returnValue($parserResultMock));
|
||||
|
||||
$cache->expects($this->never())
|
||||
->method('doSave');
|
||||
|
||||
|
@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use Doctrine\ORM\NonUniqueResultException;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use Doctrine\ORM\Query\QueryException;
|
||||
use Doctrine\ORM\UnexpectedResultException;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser,
|
||||
@ -43,7 +44,7 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$result = $query->getResult();
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $result[0][0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $result[0][0]);
|
||||
$this->assertEquals('Guilherme', $result[0][0]->name);
|
||||
$this->assertEquals('gblanco', $result[0][0]->username);
|
||||
$this->assertEquals('developer', $result[0][0]->status);
|
||||
@ -95,7 +96,7 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$query = $this->_em->createQuery("select u, a from Doctrine\Tests\Models\CMS\CmsUser u join u.articles a ORDER BY a.topic");
|
||||
$users = $query->getResult();
|
||||
$this->assertEquals(1, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertEquals(2, count($users[0]->articles));
|
||||
$this->assertEquals('Doctrine 2', $users[0]->articles[0]->topic);
|
||||
$this->assertEquals('Symfony 2', $users[0]->articles[1]->topic);
|
||||
@ -239,7 +240,7 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$topics[] = $article->topic;
|
||||
|
||||
$identityMap = $this->_em->getUnitOfWork()->getIdentityMap();
|
||||
$identityMapCount = count($identityMap['Doctrine\Tests\Models\CMS\CmsArticle']);
|
||||
$identityMapCount = count($identityMap[CmsArticle::class]);
|
||||
$this->assertTrue($identityMapCount>$iteratedCount);
|
||||
|
||||
$iteratedCount++;
|
||||
@ -417,14 +418,14 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||
$q = $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a where a.topic = :topic and a.user = :user")
|
||||
->setParameter("user", $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $author->id))
|
||||
->setParameter("user", $this->_em->getReference(CmsUser::class, $author->id))
|
||||
->setParameter("topic", "dr. dolittle");
|
||||
|
||||
$result = $q->getResult();
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsArticle', $result[0]);
|
||||
$this->assertInstanceOf(CmsArticle::class, $result[0]);
|
||||
$this->assertEquals("dr. dolittle", $result[0]->topic);
|
||||
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $result[0]->user);
|
||||
$this->assertInstanceOf(Proxy::class, $result[0]->user);
|
||||
$this->assertFalse($result[0]->user->__isInitialized__);
|
||||
}
|
||||
|
||||
@ -449,12 +450,12 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$this->_em->clear();
|
||||
|
||||
$articles = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a')
|
||||
->setFetchMode('Doctrine\Tests\Models\CMS\CmsArticle', 'user', ClassMetadata::FETCH_EAGER)
|
||||
->setFetchMode(CmsArticle::class, 'user', ClassMetadata::FETCH_EAGER)
|
||||
->getResult();
|
||||
|
||||
$this->assertEquals(10, count($articles));
|
||||
foreach ($articles AS $article) {
|
||||
$this->assertNotInstanceOf('Doctrine\ORM\Proxy\Proxy', $article);
|
||||
$this->assertNotInstanceOf(Proxy::class, $article);
|
||||
}
|
||||
}
|
||||
|
||||
@ -474,7 +475,7 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$query = $this->_em->createQuery("select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = 'gblanco'");
|
||||
|
||||
$fetchedUser = $query->getOneOrNullResult();
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $fetchedUser);
|
||||
$this->assertInstanceOf(CmsUser::class, $fetchedUser);
|
||||
$this->assertEquals('gblanco', $fetchedUser->username);
|
||||
|
||||
$query = $this->_em->createQuery("select u.username from Doctrine\Tests\Models\CMS\CmsUser u where u.username = 'gblanco'");
|
||||
@ -592,7 +593,7 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$qb = $this->_em->createQueryBuilder();
|
||||
$qb->select('u')
|
||||
->from('Doctrine\Tests\Models\CMS\CmsUser', 'u')
|
||||
->from(CmsUser::class, 'u')
|
||||
->innerJoin('u.articles', 'a')
|
||||
->where('(u.id = 0) OR (u.id IS NULL)');
|
||||
|
||||
@ -661,7 +662,7 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$users = $query->execute();
|
||||
|
||||
$this->assertEquals(3, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -724,9 +725,9 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$users = $q->execute();
|
||||
|
||||
$this->assertEquals(3, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[2]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[1]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[2]);
|
||||
|
||||
$resultUser1 = $users[0];
|
||||
$resultUser2 = $users[1];
|
||||
@ -802,8 +803,8 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$users = $query->execute();
|
||||
|
||||
$this->assertEquals(2, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $users[1]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertInstanceOf(CmsPhonenumber::class, $users[1]);
|
||||
}
|
||||
|
||||
public function testMultipleJoinComponentsUsingLeftJoin()
|
||||
@ -835,9 +836,9 @@ class QueryTest extends OrmFunctionalTestCase
|
||||
$users = $query->execute();
|
||||
|
||||
$this->assertEquals(4, count($users));
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsPhonenumber', $users[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUser', $users[2]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[0]);
|
||||
$this->assertInstanceOf(CmsPhonenumber::class, $users[1]);
|
||||
$this->assertInstanceOf(CmsUser::class, $users[2]);
|
||||
$this->assertNull($users[3]);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -17,7 +18,7 @@ class ReadOnlyTest extends OrmFunctionalTestCase
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\ReadOnlyEntity'),
|
||||
$this->_em->getClassMetadata(ReadOnlyEntity::class),
|
||||
]
|
||||
);
|
||||
} catch(\Exception $e) {
|
||||
@ -36,7 +37,7 @@ class ReadOnlyTest extends OrmFunctionalTestCase
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$dbReadOnly = $this->_em->find('Doctrine\Tests\ORM\Functional\ReadOnlyEntity', $readOnly->id);
|
||||
$dbReadOnly = $this->_em->find(ReadOnlyEntity::class, $readOnly->id);
|
||||
$this->assertEquals("Test1", $dbReadOnly->name);
|
||||
$this->assertEquals(1234, $dbReadOnly->numericValue);
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Persistence\Proxy;
|
||||
use Doctrine\Common\Util\ClassUtils;
|
||||
use Doctrine\ORM\Proxy\ProxyFactory;
|
||||
use Doctrine\ORM\Proxy\ProxyClassGenerator;
|
||||
use Doctrine\Tests\Models\Company\CompanyAuction;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceProduct;
|
||||
use Doctrine\Tests\Models\ECommerce\ECommerceShipping;
|
||||
use Doctrine\Tests\Models\Company\CompanyAuction;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -57,7 +57,7 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
$productProxy = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct', ['id' => $id]);
|
||||
$productProxy = $this->_em->getReference(ECommerceProduct::class, ['id' => $id]);
|
||||
$this->assertEquals('Doctrine Cookbook', $productProxy->getName());
|
||||
}
|
||||
|
||||
@ -68,10 +68,10 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
$class = $this->_em->getClassMetadata(get_class($entity));
|
||||
|
||||
$this->assertEquals('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $class->name);
|
||||
$this->assertEquals(ECommerceProduct::class, $class->name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,8 +81,8 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
$entity2 = $this->_em->find('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
$entity2 = $this->_em->find(ECommerceProduct::class , $id);
|
||||
|
||||
$this->assertSame($entity, $entity2);
|
||||
$this->assertEquals('Doctrine Cookbook', $entity2->getName());
|
||||
@ -95,10 +95,10 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
/* @var $entity Doctrine\Tests\Models\ECommerce\ECommerceProduct */
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
/* @var $entity ECommerceProduct */
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
|
||||
/* @var $clone Doctrine\Tests\Models\ECommerce\ECommerceProduct */
|
||||
/* @var $clone ECommerceProduct */
|
||||
$clone = clone $entity;
|
||||
|
||||
$this->assertEquals($id, $entity->getId());
|
||||
@ -120,8 +120,8 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
/* @var $entity Doctrine\Tests\Models\ECommerce\ECommerceProduct */
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
/* @var $entity ECommerceProduct */
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
|
||||
$this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy.");
|
||||
$this->_em->getUnitOfWork()->initializeObject($entity);
|
||||
@ -135,14 +135,14 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
/* @var $entity Doctrine\Tests\Models\ECommerce\ECommerceProduct */
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
/* @var $entity ECommerceProduct */
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
$entity->setName('Doctrine 2 Cookbook');
|
||||
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
$this->assertEquals('Doctrine 2 Cookbook', $entity->getName());
|
||||
}
|
||||
|
||||
@ -153,8 +153,8 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
/* @var $entity Doctrine\Tests\Models\ECommerce\ECommerceProduct */
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
/* @var $entity ECommerceProduct */
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
|
||||
$this->assertFalse($entity->wakeUp);
|
||||
|
||||
@ -167,8 +167,8 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
/* @var $entity Doctrine\Tests\Models\ECommerce\ECommerceProduct */
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
/* @var $entity ECommerceProduct */
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
|
||||
$this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy.");
|
||||
$this->assertEquals($id, $entity->getId());
|
||||
@ -182,8 +182,8 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createAuction();
|
||||
|
||||
/* @var $entity Doctrine\Tests\Models\Company\CompanyAuction */
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\Company\CompanyAuction' , $id);
|
||||
/* @var $entity CompanyAuction */
|
||||
$entity = $this->_em->getReference(CompanyAuction::class , $id);
|
||||
|
||||
$this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy.");
|
||||
$this->assertEquals($id, $entity->getId());
|
||||
@ -204,7 +204,7 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
|
||||
$id = $shipping->getId();
|
||||
|
||||
$product = $this->_em->getRepository('Doctrine\Tests\Models\ECommerce\ECommerceProduct')->find($product->getId());
|
||||
$product = $this->_em->getRepository(ECommerceProduct::class)->find($product->getId());
|
||||
|
||||
$entity = $product->getShipping();
|
||||
$this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy.");
|
||||
@ -217,8 +217,8 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$id = $this->createProduct();
|
||||
|
||||
/* @var $entity Doctrine\Tests\Models\ECommerce\ECommerceProduct */
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
/* @var $entity ECommerceProduct */
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
|
||||
$this->assertFalse($entity->__isInitialized__, "Pre-Condition: Object is unitialized proxy.");
|
||||
$this->assertEquals('Doctrine Cookbook', $entity->getName());
|
||||
@ -233,12 +233,12 @@ class ReferenceProxyTest extends OrmFunctionalTestCase
|
||||
$id = $this->createProduct();
|
||||
|
||||
/* @var $entity ECommerceProduct */
|
||||
$entity = $this->_em->getReference('Doctrine\Tests\Models\ECommerce\ECommerceProduct' , $id);
|
||||
$entity = $this->_em->getReference(ECommerceProduct::class , $id);
|
||||
$className = ClassUtils::getClass($entity);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Common\Persistence\Proxy', $entity);
|
||||
$this->assertInstanceOf(Proxy::class, $entity);
|
||||
$this->assertFalse($entity->__isInitialized());
|
||||
$this->assertEquals('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $className);
|
||||
$this->assertEquals(ECommerceProduct::class, $className);
|
||||
|
||||
$restName = str_replace($this->_em->getConfiguration()->getProxyNamespace(), "", get_class($entity));
|
||||
$restName = substr(get_class($entity), strlen($this->_em->getConfiguration()->getProxyNamespace()) +1);
|
||||
|
@ -22,7 +22,7 @@ class ResultCacheTest extends OrmFunctionalTestCase
|
||||
private $cacheDataReflection;
|
||||
|
||||
protected function setUp() {
|
||||
$this->cacheDataReflection = new \ReflectionProperty("Doctrine\Common\Cache\ArrayCache", "data");
|
||||
$this->cacheDataReflection = new \ReflectionProperty(ArrayCache::class, "data");
|
||||
$this->cacheDataReflection->setAccessible(true);
|
||||
$this->useModelSet('cms');
|
||||
parent::setUp();
|
||||
|
@ -2,26 +2,27 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Common\Cache\ArrayCache;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Types\Type as DBALType;
|
||||
use Doctrine\ORM\Configuration;
|
||||
use Doctrine\ORM\Query\Filter\SQLFilter;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\Common\Cache\ArrayCache;
|
||||
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\ORM\Query\Filter\SQLFilter;
|
||||
use Doctrine\ORM\Query\FilterCollection;
|
||||
use Doctrine\Tests\Models\CMS\CmsAddress;
|
||||
use Doctrine\Tests\Models\CMS\CmsGroup;
|
||||
use Doctrine\Tests\Models\CMS\CmsArticle;
|
||||
|
||||
use Doctrine\Tests\Models\Company\CompanyPerson;
|
||||
use Doctrine\Tests\Models\Company\CompanyManager;
|
||||
use Doctrine\Tests\Models\Company\CompanyOrganization;
|
||||
use Doctrine\Tests\Models\CMS\CmsGroup;
|
||||
use Doctrine\Tests\Models\CMS\CmsUser;
|
||||
use Doctrine\Tests\Models\Company\CompanyAuction;
|
||||
|
||||
use Doctrine\Tests\Models\Company\CompanyContract;
|
||||
use Doctrine\Tests\Models\Company\CompanyEvent;
|
||||
use Doctrine\Tests\Models\Company\CompanyFlexContract;
|
||||
use Doctrine\Tests\Models\Company\CompanyFlexUltraContract;
|
||||
use Doctrine\Tests\Models\Company\CompanyManager;
|
||||
use Doctrine\Tests\Models\Company\CompanyOrganization;
|
||||
use Doctrine\Tests\Models\Company\CompanyPerson;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -49,7 +50,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$class = $this->_em->getClassMetadata(CmsUser::class);
|
||||
$class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
|
||||
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_LAZY;
|
||||
}
|
||||
@ -186,7 +187,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
protected function getMockConnection()
|
||||
{
|
||||
// Setup connection mock
|
||||
$conn = $this->getMockBuilder('Doctrine\DBAL\Connection')
|
||||
$conn = $this->getMockBuilder(Connection::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@ -196,7 +197,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
protected function getMockEntityManager()
|
||||
{
|
||||
// Setup connection mock
|
||||
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
|
||||
$em = $this->getMockBuilder(EntityManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@ -205,7 +206,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
|
||||
protected function addMockFilterCollection($em)
|
||||
{
|
||||
$filterCollection = $this->getMockBuilder('Doctrine\ORM\Query\FilterCollection')
|
||||
$filterCollection = $this->getMockBuilder(FilterCollection::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@ -258,7 +259,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
|
||||
$filter = new MyLocaleFilter($em);
|
||||
|
||||
$reflMethod = new \ReflectionMethod('Doctrine\ORM\Query\Filter\SQLFilter', 'getConnection');
|
||||
$reflMethod = new \ReflectionMethod(SQLFilter::class, 'getConnection');
|
||||
$reflMethod->setAccessible(true);
|
||||
|
||||
$this->assertSame($conn, $reflMethod->invoke($filter));
|
||||
@ -293,7 +294,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
public function testSQLFilterAddConstraint()
|
||||
{
|
||||
// Set up metadata mock
|
||||
$targetEntity = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')
|
||||
$targetEntity = $this->getMockBuilder(ClassMetadata::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@ -333,7 +334,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testQueryCache_DependsOnFilters()
|
||||
{
|
||||
$cacheDataReflection = new \ReflectionProperty("Doctrine\Common\Cache\ArrayCache", "data");
|
||||
$cacheDataReflection = new \ReflectionProperty(ArrayCache::class, "data");
|
||||
$cacheDataReflection->setAccessible(true);
|
||||
|
||||
$query = $this->_em->createQuery('select ux from Doctrine\Tests\Models\CMS\CmsUser ux');
|
||||
@ -373,40 +374,40 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixtureData();
|
||||
|
||||
$this->assertNotNull($this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->find($this->groupId));
|
||||
$this->assertNotNull($this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->find($this->groupId2));
|
||||
$this->assertNotNull($this->_em->getRepository(CmsGroup::class)->find($this->groupId));
|
||||
$this->assertNotNull($this->_em->getRepository(CmsGroup::class)->find($this->groupId2));
|
||||
|
||||
$this->useCMSGroupPrefixFilter();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertNotNull($this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->find($this->groupId));
|
||||
$this->assertNull($this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->find($this->groupId2));
|
||||
$this->assertNotNull($this->_em->getRepository(CmsGroup::class)->find($this->groupId));
|
||||
$this->assertNull($this->_em->getRepository(CmsGroup::class)->find($this->groupId2));
|
||||
}
|
||||
|
||||
public function testRepositoryFindAll()
|
||||
{
|
||||
$this->loadFixtureData();
|
||||
|
||||
$this->assertCount(2, $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findAll());
|
||||
$this->assertCount(2, $this->_em->getRepository(CmsGroup::class)->findAll());
|
||||
|
||||
$this->useCMSGroupPrefixFilter();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertCount(1, $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findAll());
|
||||
$this->assertCount(1, $this->_em->getRepository(CmsGroup::class)->findAll());
|
||||
}
|
||||
|
||||
public function testRepositoryFindBy()
|
||||
{
|
||||
$this->loadFixtureData();
|
||||
|
||||
$this->assertCount(1, $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findBy(
|
||||
$this->assertCount(1, $this->_em->getRepository(CmsGroup::class)->findBy(
|
||||
['id' => $this->groupId2]
|
||||
));
|
||||
|
||||
$this->useCMSGroupPrefixFilter();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertCount(0, $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findBy(
|
||||
$this->assertCount(0, $this->_em->getRepository(CmsGroup::class)->findBy(
|
||||
['id' => $this->groupId2]
|
||||
));
|
||||
}
|
||||
@ -415,26 +416,26 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixtureData();
|
||||
|
||||
$this->assertCount(1, $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findById($this->groupId2));
|
||||
$this->assertCount(1, $this->_em->getRepository(CmsGroup::class)->findById($this->groupId2));
|
||||
|
||||
$this->useCMSGroupPrefixFilter();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertCount(0, $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findById($this->groupId2));
|
||||
$this->assertCount(0, $this->_em->getRepository(CmsGroup::class)->findById($this->groupId2));
|
||||
}
|
||||
|
||||
public function testRepositoryFindOneBy()
|
||||
{
|
||||
$this->loadFixtureData();
|
||||
|
||||
$this->assertNotNull($this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findOneBy(
|
||||
$this->assertNotNull($this->_em->getRepository(CmsGroup::class)->findOneBy(
|
||||
['id' => $this->groupId2]
|
||||
));
|
||||
|
||||
$this->useCMSGroupPrefixFilter();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertNull($this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findOneBy(
|
||||
$this->assertNull($this->_em->getRepository(CmsGroup::class)->findOneBy(
|
||||
['id' => $this->groupId2]
|
||||
));
|
||||
}
|
||||
@ -443,12 +444,12 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadFixtureData();
|
||||
|
||||
$this->assertNotNull($this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findOneById($this->groupId2));
|
||||
$this->assertNotNull($this->_em->getRepository(CmsGroup::class)->findOneById($this->groupId2));
|
||||
|
||||
$this->useCMSGroupPrefixFilter();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertNull($this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsGroup')->findOneById($this->groupId2));
|
||||
$this->assertNull($this->_em->getRepository(CmsGroup::class)->findOneById($this->groupId2));
|
||||
}
|
||||
|
||||
public function testToOneFilter()
|
||||
@ -521,7 +522,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
|
||||
private function loadLazyFixtureData()
|
||||
{
|
||||
$class = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser');
|
||||
$class = $this->_em->getClassMetadata(CmsUser::class);
|
||||
$class->associationMappings['articles']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
|
||||
$class->associationMappings['groups']['fetch'] = ClassMetadataInfo::FETCH_EXTRA_LAZY;
|
||||
$this->loadFixtureData();
|
||||
@ -537,7 +538,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
public function testOneToMany_ExtraLazyCountWithFilter()
|
||||
{
|
||||
$this->loadLazyFixtureData();
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$this->assertFalse($user->articles->isInitialized());
|
||||
$this->assertEquals(2, count($user->articles));
|
||||
@ -550,8 +551,8 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
public function testOneToMany_ExtraLazyContainsWithFilter()
|
||||
{
|
||||
$this->loadLazyFixtureData();
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$filteredArticle = $this->_em->find('Doctrine\Tests\Models\CMS\CmsArticle', $this->articleId2);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
$filteredArticle = $this->_em->find(CmsArticle::class, $this->articleId2);
|
||||
|
||||
$this->assertFalse($user->articles->isInitialized());
|
||||
$this->assertTrue($user->articles->contains($filteredArticle));
|
||||
@ -564,7 +565,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
public function testOneToMany_ExtraLazySliceWithFilter()
|
||||
{
|
||||
$this->loadLazyFixtureData();
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId);
|
||||
|
||||
$this->assertFalse($user->articles->isInitialized());
|
||||
$this->assertEquals(2, count($user->articles->slice(0,10)));
|
||||
@ -585,7 +586,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadLazyFixtureData();
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId2);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId2);
|
||||
|
||||
$this->assertFalse($user->groups->isInitialized());
|
||||
$this->assertEquals(2, count($user->groups));
|
||||
@ -598,8 +599,8 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
public function testManyToMany_ExtraLazyContainsWithFilter()
|
||||
{
|
||||
$this->loadLazyFixtureData();
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId2);
|
||||
$filteredArticle = $this->_em->find('Doctrine\Tests\Models\CMS\CmsGroup', $this->groupId2);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId2);
|
||||
$filteredArticle = $this->_em->find(CmsGroup::class, $this->groupId2);
|
||||
|
||||
$this->assertFalse($user->groups->isInitialized());
|
||||
$this->assertTrue($user->groups->contains($filteredArticle));
|
||||
@ -612,7 +613,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
public function testManyToMany_ExtraLazySliceWithFilter()
|
||||
{
|
||||
$this->loadLazyFixtureData();
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId2);
|
||||
$user = $this->_em->find(CmsUser::class, $this->userId2);
|
||||
|
||||
$this->assertFalse($user->groups->isInitialized());
|
||||
$this->assertEquals(2, count($user->groups->slice(0,10)));
|
||||
@ -690,14 +691,14 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanyJoinedSubclassFixtureData();
|
||||
// Persister
|
||||
$this->assertEquals(2, count($this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyManager')->findAll()));
|
||||
$this->assertEquals(2, count($this->_em->getRepository(CompanyManager::class)->findAll()));
|
||||
// SQLWalker
|
||||
$this->assertEquals(2, count($this->_em->createQuery("SELECT cm FROM Doctrine\Tests\Models\Company\CompanyManager cm")->getResult()));
|
||||
|
||||
// Enable the filter
|
||||
$this->usePersonNameFilter('Guilh%');
|
||||
|
||||
$managers = $this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyManager')->findAll();
|
||||
$managers = $this->_em->getRepository(CompanyManager::class)->findAll();
|
||||
$this->assertEquals(1, count($managers));
|
||||
$this->assertEquals("Guilherme", $managers[0]->getName());
|
||||
|
||||
@ -707,13 +708,13 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingRootEntity()
|
||||
{
|
||||
$this->loadCompanyJoinedSubclassFixtureData();
|
||||
$this->assertEquals(3, count($this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyPerson')->findAll()));
|
||||
$this->assertEquals(3, count($this->_em->getRepository(CompanyPerson::class)->findAll()));
|
||||
$this->assertEquals(3, count($this->_em->createQuery("SELECT cp FROM Doctrine\Tests\Models\Company\CompanyPerson cp")->getResult()));
|
||||
|
||||
// Enable the filter
|
||||
$this->usePersonNameFilter('Guilh%');
|
||||
|
||||
$persons = $this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyPerson')->findAll();
|
||||
$persons = $this->_em->getRepository(CompanyPerson::class)->findAll();
|
||||
$this->assertEquals(1, count($persons));
|
||||
$this->assertEquals("Guilherme", $persons[0]->getName());
|
||||
|
||||
@ -748,7 +749,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
// Persister
|
||||
$this->assertEquals(2, count($this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyFlexUltraContract')->findAll()));
|
||||
$this->assertEquals(2, count($this->_em->getRepository(CompanyFlexUltraContract::class)->findAll()));
|
||||
// SQLWalker
|
||||
$this->assertEquals(2, count($this->_em->createQuery("SELECT cfc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract cfc")->getResult()));
|
||||
|
||||
@ -759,14 +760,14 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
->enable("completed_contract")
|
||||
->setParameter("completed", true, DBALType::BOOLEAN);
|
||||
|
||||
$this->assertEquals(1, count($this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyFlexUltraContract')->findAll()));
|
||||
$this->assertEquals(1, count($this->_em->getRepository(CompanyFlexUltraContract::class)->findAll()));
|
||||
$this->assertEquals(1, count($this->_em->createQuery("SELECT cfc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract cfc")->getResult()));
|
||||
}
|
||||
|
||||
public function testSingleTableInheritance_FilterOnlyOnRootTableWhenFetchingRootEntity()
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
$this->assertEquals(4, count($this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyFlexContract')->findAll()));
|
||||
$this->assertEquals(4, count($this->_em->getRepository(CompanyFlexContract::class)->findAll()));
|
||||
$this->assertEquals(4, count($this->_em->createQuery("SELECT cfc FROM Doctrine\Tests\Models\Company\CompanyFlexContract cfc")->getResult()));
|
||||
|
||||
// Enable the filter
|
||||
@ -776,7 +777,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
->enable("completed_contract")
|
||||
->setParameter("completed", true, DBALType::BOOLEAN);
|
||||
|
||||
$this->assertEquals(2, count($this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyFlexContract')->findAll()));
|
||||
$this->assertEquals(2, count($this->_em->getRepository(CompanyFlexContract::class)->findAll()));
|
||||
$this->assertEquals(2, count($this->_em->createQuery("SELECT cfc FROM Doctrine\Tests\Models\Company\CompanyFlexContract cfc")->getResult()));
|
||||
}
|
||||
|
||||
@ -840,7 +841,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $this->managerId);
|
||||
$manager = $this->_em->find(CompanyManager::class, $this->managerId);
|
||||
|
||||
$this->assertFalse($manager->managedContracts->isInitialized());
|
||||
$this->assertEquals(4, count($manager->managedContracts));
|
||||
@ -856,9 +857,9 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $this->managerId);
|
||||
$contract1 = $this->_em->find('Doctrine\Tests\Models\Company\CompanyContract', $this->contractId1);
|
||||
$contract2 = $this->_em->find('Doctrine\Tests\Models\Company\CompanyContract', $this->contractId2);
|
||||
$manager = $this->_em->find(CompanyManager::class, $this->managerId);
|
||||
$contract1 = $this->_em->find(CompanyContract::class, $this->contractId1);
|
||||
$contract2 = $this->_em->find(CompanyContract::class, $this->contractId2);
|
||||
|
||||
$this->assertFalse($manager->managedContracts->isInitialized());
|
||||
$this->assertTrue($manager->managedContracts->contains($contract1));
|
||||
@ -876,7 +877,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $this->managerId);
|
||||
$manager = $this->_em->find(CompanyManager::class, $this->managerId);
|
||||
|
||||
$this->assertFalse($manager->managedContracts->isInitialized());
|
||||
$this->assertEquals(4, count($manager->managedContracts->slice(0, 10)));
|
||||
@ -902,7 +903,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$contract = $this->_em->find('Doctrine\Tests\Models\Company\CompanyFlexUltraContract', $this->contractId1);
|
||||
$contract = $this->_em->find(CompanyFlexUltraContract::class, $this->contractId1);
|
||||
|
||||
$this->assertFalse($contract->managers->isInitialized());
|
||||
$this->assertEquals(2, count($contract->managers));
|
||||
@ -918,9 +919,9 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$contract = $this->_em->find('Doctrine\Tests\Models\Company\CompanyFlexUltraContract', $this->contractId1);
|
||||
$manager1 = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $this->managerId);
|
||||
$manager2 = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $this->managerId2);
|
||||
$contract = $this->_em->find(CompanyFlexUltraContract::class, $this->contractId1);
|
||||
$manager1 = $this->_em->find(CompanyManager::class, $this->managerId);
|
||||
$manager2 = $this->_em->find(CompanyManager::class, $this->managerId2);
|
||||
|
||||
$this->assertFalse($contract->managers->isInitialized());
|
||||
$this->assertTrue($contract->managers->contains($manager1));
|
||||
@ -938,7 +939,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$contract = $this->_em->find('Doctrine\Tests\Models\Company\CompanyFlexUltraContract', $this->contractId1);
|
||||
$contract = $this->_em->find(CompanyFlexUltraContract::class, $this->contractId1);
|
||||
|
||||
$this->assertFalse($contract->managers->isInitialized());
|
||||
$this->assertEquals(2, count($contract->managers->slice(0, 10)));
|
||||
@ -954,7 +955,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $this->managerId);
|
||||
$manager = $this->_em->find(CompanyManager::class, $this->managerId);
|
||||
|
||||
$this->assertFalse($manager->soldContracts->isInitialized());
|
||||
$this->assertEquals(2, count($manager->soldContracts));
|
||||
@ -970,9 +971,9 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $this->managerId);
|
||||
$contract1 = $this->_em->find('Doctrine\Tests\Models\Company\CompanyContract', $this->contractId1);
|
||||
$contract2 = $this->_em->find('Doctrine\Tests\Models\Company\CompanyContract', $this->contractId2);
|
||||
$manager = $this->_em->find(CompanyManager::class, $this->managerId);
|
||||
$contract1 = $this->_em->find(CompanyContract::class, $this->contractId1);
|
||||
$contract2 = $this->_em->find(CompanyContract::class, $this->contractId2);
|
||||
|
||||
$this->assertFalse($manager->soldContracts->isInitialized());
|
||||
$this->assertTrue($manager->soldContracts->contains($contract1));
|
||||
@ -991,7 +992,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
|
||||
$this->loadCompanySingleTableInheritanceFixtureData();
|
||||
|
||||
$manager = $this->_em->find('Doctrine\Tests\Models\Company\CompanyManager', $this->managerId);
|
||||
$manager = $this->_em->find(CompanyManager::class, $this->managerId);
|
||||
|
||||
$this->assertFalse($manager->soldContracts->isInitialized());
|
||||
$this->assertEquals(2, count($manager->soldContracts->slice(0, 10)));
|
||||
@ -1028,7 +1029,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
// Enable the filter
|
||||
$conf = $this->_em->getConfiguration();
|
||||
$conf->addFilter("event_id", "\Doctrine\Tests\ORM\Functional\CompanyEventFilter");
|
||||
$conf->addFilter("event_id", CompanyEventFilter::class);
|
||||
$this->_em->getFilters()
|
||||
->enable("event_id")
|
||||
->setParameter("id", $this->eventId2);
|
||||
@ -1039,7 +1040,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanyOrganizationEventJoinedSubclassFixtureData();
|
||||
|
||||
$organization = $this->_em->find('Doctrine\Tests\Models\Company\CompanyOrganization', $this->organizationId);
|
||||
$organization = $this->_em->find(CompanyOrganization::class, $this->organizationId);
|
||||
|
||||
$this->assertFalse($organization->events->isInitialized());
|
||||
$this->assertEquals(2, count($organization->events));
|
||||
@ -1055,10 +1056,10 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanyOrganizationEventJoinedSubclassFixtureData();
|
||||
|
||||
$organization = $this->_em->find('Doctrine\Tests\Models\Company\CompanyOrganization', $this->organizationId);
|
||||
$organization = $this->_em->find(CompanyOrganization::class, $this->organizationId);
|
||||
|
||||
$event1 = $this->_em->find('Doctrine\Tests\Models\Company\CompanyEvent', $this->eventId1);
|
||||
$event2 = $this->_em->find('Doctrine\Tests\Models\Company\CompanyEvent', $this->eventId2);
|
||||
$event1 = $this->_em->find(CompanyEvent::class, $this->eventId1);
|
||||
$event2 = $this->_em->find(CompanyEvent::class, $this->eventId2);
|
||||
|
||||
$this->assertFalse($organization->events->isInitialized());
|
||||
$this->assertTrue($organization->events->contains($event1));
|
||||
@ -1076,7 +1077,7 @@ class SQLFilterTest extends OrmFunctionalTestCase
|
||||
{
|
||||
$this->loadCompanyOrganizationEventJoinedSubclassFixtureData();
|
||||
|
||||
$organization = $this->_em->find('Doctrine\Tests\Models\Company\CompanyOrganization', $this->organizationId);
|
||||
$organization = $this->_em->find(CompanyOrganization::class, $this->organizationId);
|
||||
|
||||
$this->assertFalse($organization->events->isInitialized());
|
||||
$this->assertEquals(2, count($organization->events->slice(0, 10)));
|
||||
@ -1117,7 +1118,7 @@ class CMSCountryFilter extends SQLFilter
|
||||
{
|
||||
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
|
||||
{
|
||||
if ($targetEntity->name != "Doctrine\Tests\Models\CMS\CmsAddress") {
|
||||
if ($targetEntity->name != CmsAddress::class) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -1129,7 +1130,7 @@ class CMSGroupPrefixFilter extends SQLFilter
|
||||
{
|
||||
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
|
||||
{
|
||||
if ($targetEntity->name != "Doctrine\Tests\Models\CMS\CmsGroup") {
|
||||
if ($targetEntity->name != CmsGroup::class) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -1141,7 +1142,7 @@ class CMSArticleTopicFilter extends SQLFilter
|
||||
{
|
||||
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias)
|
||||
{
|
||||
if ($targetEntity->name != "Doctrine\Tests\Models\CMS\CmsArticle") {
|
||||
if ($targetEntity->name != CmsArticle::class) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -1153,7 +1154,7 @@ class CompanyPersonNameFilter extends SQLFilter
|
||||
{
|
||||
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias, $targetTable = '')
|
||||
{
|
||||
if ($targetEntity->name != "Doctrine\Tests\Models\Company\CompanyPerson") {
|
||||
if ($targetEntity->name != CompanyPerson::class) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -1165,7 +1166,7 @@ class CompletedContractFilter extends SQLFilter
|
||||
{
|
||||
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias, $targetTable = '')
|
||||
{
|
||||
if ($targetEntity->name != "Doctrine\Tests\Models\Company\CompanyContract") {
|
||||
if ($targetEntity->name != CompanyContract::class) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -1177,7 +1178,7 @@ class CompanyEventFilter extends SQLFilter
|
||||
{
|
||||
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias, $targetTable = '')
|
||||
{
|
||||
if ($targetEntity->name != "Doctrine\Tests\Models\Company\CompanyEvent") {
|
||||
if ($targetEntity->name != CompanyEvent::class) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Doctrine\Tests\ORM\Functional\SchemaTool;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Tests\Models\Company\CompanyManager;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -61,7 +62,7 @@ class CompanySchemaTest extends OrmFunctionalTestCase
|
||||
|
||||
$sql = $this->_schemaTool->getDropSchemaSQL(
|
||||
[
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\Company\CompanyManager'),
|
||||
$this->_em->getClassMetadata(CompanyManager::class),
|
||||
]
|
||||
);
|
||||
$this->assertEquals(4, count($sql));
|
||||
|
@ -21,7 +21,7 @@ class DBAL483Test extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testDefaultValueIsComparedCorrectly()
|
||||
{
|
||||
$class = $this->_em->getClassMetadata(__NAMESPACE__ . '\\DBAL483Default');
|
||||
$class = $this->_em->getClassMetadata(DBAL483Default::class);
|
||||
|
||||
$this->schemaTool->createSchema([$class]);
|
||||
|
||||
|
@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool;
|
||||
|
||||
use Doctrine\DBAL\Schema\Comparator;
|
||||
use Doctrine\ORM\Tools;
|
||||
use Doctrine\Tests\Models;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
/**
|
||||
@ -32,12 +33,12 @@ class DDC214Test extends OrmFunctionalTestCase
|
||||
public function testCmsAddressModel()
|
||||
{
|
||||
$this->classes = [
|
||||
'Doctrine\Tests\Models\CMS\CmsUser',
|
||||
'Doctrine\Tests\Models\CMS\CmsPhonenumber',
|
||||
'Doctrine\Tests\Models\CMS\CmsAddress',
|
||||
'Doctrine\Tests\Models\CMS\CmsGroup',
|
||||
'Doctrine\Tests\Models\CMS\CmsArticle',
|
||||
'Doctrine\Tests\Models\CMS\CmsEmail',
|
||||
Models\CMS\CmsUser::class,
|
||||
Models\CMS\CmsPhonenumber::class,
|
||||
Models\CMS\CmsAddress::class,
|
||||
Models\CMS\CmsGroup::class,
|
||||
Models\CMS\CmsArticle::class,
|
||||
Models\CMS\CmsEmail::class,
|
||||
];
|
||||
|
||||
$this->assertCreatedSchemaNeedsNoUpdates($this->classes);
|
||||
@ -49,14 +50,14 @@ class DDC214Test extends OrmFunctionalTestCase
|
||||
public function testCompanyModel()
|
||||
{
|
||||
$this->classes = [
|
||||
'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'
|
||||
Models\Company\CompanyPerson::class,
|
||||
Models\Company\CompanyEmployee::class,
|
||||
Models\Company\CompanyManager::class,
|
||||
Models\Company\CompanyOrganization::class,
|
||||
Models\Company\CompanyEvent::class,
|
||||
Models\Company\CompanyAuction::class,
|
||||
Models\Company\CompanyRaffle::class,
|
||||
Models\Company\CompanyCar::class
|
||||
];
|
||||
|
||||
$this->assertCreatedSchemaNeedsNoUpdates($this->classes);
|
||||
|
@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool;
|
||||
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Doctrine\Tests\Models;
|
||||
|
||||
class MySqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
{
|
||||
@ -17,12 +18,12 @@ class MySqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testGetCreateSchemaSql()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsGroup'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsTag'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsEmail'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber'),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsGroup::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsUser::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsTag::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsAddress::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsEmail::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsPhonenumber::class),
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
@ -50,7 +51,7 @@ class MySqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testGetCreateSchemaSql2()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\Generic\DecimalModel')
|
||||
$this->_em->getClassMetadata(Models\Generic\DecimalModel::class)
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
@ -63,7 +64,7 @@ class MySqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testGetCreateSchemaSql3()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\Generic\BooleanModel')
|
||||
$this->_em->getClassMetadata(Models\Generic\BooleanModel::class)
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
@ -79,7 +80,7 @@ class MySqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testGetCreateSchemaSql4()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\\MysqlSchemaNamespacedEntity')
|
||||
$this->_em->getClassMetadata(MysqlSchemaNamespacedEntity::class)
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace Doctrine\Tests\ORM\Functional\SchemaTool;
|
||||
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Doctrine\Tests\Models;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
class PostgreSqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
@ -18,7 +19,7 @@ class PostgreSqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testPostgresMetadataSequenceIncrementedBy10()
|
||||
{
|
||||
$address = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$address = $this->_em->getClassMetadata(Models\CMS\CmsAddress::class);
|
||||
|
||||
$this->assertEquals(1, $address->sequenceGeneratorDefinition['allocationSize']);
|
||||
}
|
||||
@ -26,9 +27,9 @@ class PostgreSqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testGetCreateSchemaSql()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber'),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsAddress::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsUser::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsPhonenumber::class),
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
@ -65,7 +66,7 @@ class PostgreSqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testGetCreateSchemaSql2()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\Generic\DecimalModel')
|
||||
$this->_em->getClassMetadata(Models\Generic\DecimalModel::class)
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
@ -80,7 +81,7 @@ class PostgreSqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testGetCreateSchemaSql3()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\Generic\BooleanModel')
|
||||
$this->_em->getClassMetadata(Models\Generic\BooleanModel::class)
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
@ -94,9 +95,9 @@ class PostgreSqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testGetDropSchemaSql()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsUser'),
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsPhonenumber'),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsAddress::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsUser::class),
|
||||
$this->_em->getClassMetadata(Models\CMS\CmsPhonenumber::class),
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
@ -120,8 +121,8 @@ class PostgreSqlSchemaToolTest extends OrmFunctionalTestCase
|
||||
public function testUpdateSchemaWithPostgreSQLSchema()
|
||||
{
|
||||
$classes = [
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1657Screen'),
|
||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1657Avatar'),
|
||||
$this->_em->getClassMetadata(DDC1657Screen::class),
|
||||
$this->_em->getClassMetadata(DDC1657Avatar::class),
|
||||
];
|
||||
|
||||
$tool = new SchemaTool($this->_em);
|
||||
|
@ -21,8 +21,8 @@ class SecondLevelCacheCompositePrimaryKeyTest extends SecondLevelCacheAbstractTe
|
||||
|
||||
$leavingFromId = $this->cities[0]->getId();
|
||||
$goingToId = $this->cities[1]->getId();
|
||||
$leavingFrom = $this->_em->find(City::CLASSNAME, $leavingFromId);
|
||||
$goingTo = $this->_em->find(City::CLASSNAME, $goingToId);
|
||||
$leavingFrom = $this->_em->find(City::class, $leavingFromId);
|
||||
$goingTo = $this->_em->find(City::class, $goingToId);
|
||||
$flight = new Flight($leavingFrom, $goingTo);
|
||||
$id = [
|
||||
'leavingFrom' => $leavingFromId,
|
||||
@ -31,25 +31,25 @@ class SecondLevelCacheCompositePrimaryKeyTest extends SecondLevelCacheAbstractTe
|
||||
|
||||
$flight->setDeparture(new \DateTime('tomorrow'));
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[1]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[1]->getId()));
|
||||
|
||||
$this->_em->persist($flight);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(Flight::CLASSNAME, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[1]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(Flight::class, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[1]->getId()));
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
$flight = $this->_em->find(Flight::CLASSNAME, $id);
|
||||
$flight = $this->_em->find(Flight::class, $id);
|
||||
$leavingFrom = $flight->getLeavingFrom();
|
||||
$goingTo = $flight->getGoingTo();
|
||||
|
||||
$this->assertInstanceOf(Flight::CLASSNAME, $flight);
|
||||
$this->assertInstanceOf(City::CLASSNAME, $goingTo);
|
||||
$this->assertInstanceOf(City::CLASSNAME, $leavingFrom);
|
||||
$this->assertInstanceOf(Flight::class, $flight);
|
||||
$this->assertInstanceOf(City::class, $goingTo);
|
||||
$this->assertInstanceOf(City::class, $leavingFrom);
|
||||
|
||||
$this->assertEquals($goingTo->getId(), $goingToId);
|
||||
$this->assertEquals($leavingFrom->getId(), $leavingFromId);
|
||||
@ -67,8 +67,8 @@ class SecondLevelCacheCompositePrimaryKeyTest extends SecondLevelCacheAbstractTe
|
||||
|
||||
$leavingFromId = $this->cities[0]->getId();
|
||||
$goingToId = $this->cities[1]->getId();
|
||||
$leavingFrom = $this->_em->find(City::CLASSNAME, $leavingFromId);
|
||||
$goingTo = $this->_em->find(City::CLASSNAME, $goingToId);
|
||||
$leavingFrom = $this->_em->find(City::class, $leavingFromId);
|
||||
$goingTo = $this->_em->find(City::class, $goingToId);
|
||||
$flight = new Flight($leavingFrom, $goingTo);
|
||||
$id = [
|
||||
'leavingFrom' => $leavingFromId,
|
||||
@ -77,25 +77,25 @@ class SecondLevelCacheCompositePrimaryKeyTest extends SecondLevelCacheAbstractTe
|
||||
|
||||
$flight->setDeparture(new \DateTime('tomorrow'));
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[1]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[1]->getId()));
|
||||
|
||||
$this->_em->persist($flight);
|
||||
$this->_em->flush();
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(Flight::CLASSNAME, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[1]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(Flight::class, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[1]->getId()));
|
||||
|
||||
$this->_em->remove($flight);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertFalse($this->cache->containsEntity(Flight::CLASSNAME, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[1]->getId()));
|
||||
$this->assertFalse($this->cache->containsEntity(Flight::class, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[1]->getId()));
|
||||
|
||||
$this->assertNull($this->_em->find(Flight::CLASSNAME, $id));
|
||||
$this->assertNull($this->_em->find(Flight::class, $id));
|
||||
}
|
||||
|
||||
public function testUpdateCompositPrimaryKeyEntities()
|
||||
@ -111,8 +111,8 @@ class SecondLevelCacheCompositePrimaryKeyTest extends SecondLevelCacheAbstractTe
|
||||
$tomorrow = new \DateTime('tomorrow');
|
||||
$leavingFromId = $this->cities[0]->getId();
|
||||
$goingToId = $this->cities[1]->getId();
|
||||
$leavingFrom = $this->_em->find(City::CLASSNAME, $leavingFromId);
|
||||
$goingTo = $this->_em->find(City::CLASSNAME, $goingToId);
|
||||
$leavingFrom = $this->_em->find(City::class, $leavingFromId);
|
||||
$goingTo = $this->_em->find(City::class, $goingToId);
|
||||
$flight = new Flight($leavingFrom, $goingTo);
|
||||
$id = [
|
||||
'leavingFrom' => $leavingFromId,
|
||||
@ -121,25 +121,25 @@ class SecondLevelCacheCompositePrimaryKeyTest extends SecondLevelCacheAbstractTe
|
||||
|
||||
$flight->setDeparture($now);
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[1]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[1]->getId()));
|
||||
|
||||
$this->_em->persist($flight);
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(Flight::CLASSNAME, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[1]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(Flight::class, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[1]->getId()));
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
$flight = $this->_em->find(Flight::CLASSNAME, $id);
|
||||
$flight = $this->_em->find(Flight::class, $id);
|
||||
$leavingFrom = $flight->getLeavingFrom();
|
||||
$goingTo = $flight->getGoingTo();
|
||||
|
||||
$this->assertInstanceOf(Flight::CLASSNAME, $flight);
|
||||
$this->assertInstanceOf(City::CLASSNAME, $goingTo);
|
||||
$this->assertInstanceOf(City::CLASSNAME, $leavingFrom);
|
||||
$this->assertInstanceOf(Flight::class, $flight);
|
||||
$this->assertInstanceOf(City::class, $goingTo);
|
||||
$this->assertInstanceOf(City::class, $leavingFrom);
|
||||
|
||||
$this->assertEquals($goingTo->getId(), $goingToId);
|
||||
$this->assertEquals($flight->getDeparture(), $now);
|
||||
@ -153,18 +153,18 @@ class SecondLevelCacheCompositePrimaryKeyTest extends SecondLevelCacheAbstractTe
|
||||
$this->_em->flush();
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertTrue($this->cache->containsEntity(Flight::CLASSNAME, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::CLASSNAME, $this->cities[1]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(Flight::class, $id));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[0]->getId()));
|
||||
$this->assertTrue($this->cache->containsEntity(City::class, $this->cities[1]->getId()));
|
||||
|
||||
$queryCount = $this->getCurrentQueryCount();
|
||||
$flight = $this->_em->find(Flight::CLASSNAME, $id);
|
||||
$flight = $this->_em->find(Flight::class, $id);
|
||||
$leavingFrom = $flight->getLeavingFrom();
|
||||
$goingTo = $flight->getGoingTo();
|
||||
|
||||
$this->assertInstanceOf(Flight::CLASSNAME, $flight);
|
||||
$this->assertInstanceOf(City::CLASSNAME, $goingTo);
|
||||
$this->assertInstanceOf(City::CLASSNAME, $leavingFrom);
|
||||
$this->assertInstanceOf(Flight::class, $flight);
|
||||
$this->assertInstanceOf(City::class, $goingTo);
|
||||
$this->assertInstanceOf(City::class, $leavingFrom);
|
||||
|
||||
$this->assertEquals($goingTo->getId(), $goingToId);
|
||||
$this->assertEquals($flight->getDeparture(), $tomorrow);
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Doctrine\Tests\Models\GeoNames\Country;
|
||||
use Doctrine\Tests\Models\GeoNames\Admin1;
|
||||
use Doctrine\Tests\Models\GeoNames\Admin1AlternateName;
|
||||
use Doctrine\Tests\Models\GeoNames\Country;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
class SecondLevelCacheCompositePrimaryKeyWithAssociationsTest extends OrmFunctionalTestCase
|
||||
{
|
||||
@ -51,7 +51,7 @@ class SecondLevelCacheCompositePrimaryKeyWithAssociationsTest extends OrmFunctio
|
||||
|
||||
public function testFindByReturnsCachedEntity()
|
||||
{
|
||||
$admin1Repo = $this->_em->getRepository('Doctrine\Tests\Models\GeoNames\Admin1');
|
||||
$admin1Repo = $this->_em->getRepository(Admin1::class);
|
||||
|
||||
$queries = $this->getCurrentQueryCount();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user