Skip to content

Commit

Permalink
Remove full qualified class names in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
munkie committed May 10, 2016
1 parent bf322b9 commit b173763
Show file tree
Hide file tree
Showing 95 changed files with 417 additions and 290 deletions.
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/EventListener/CacheMetadataListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $event)
*
* @return bool
*/
private function isVisited(ClassMetaData $metadata)
private function isVisited(ClassMetadata $metadata)
{
return isset($this->enabledItems[$metadata->getName()]);
}

/**
* @param ClassMetadata $metadata
*/
private function recordVisit(ClassMetaData $metadata)
private function recordVisit(ClassMetadata $metadata)
{
$this->enabledItems[$metadata->getName()] = true;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC2504/DDC2504RootClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DDC2504RootClass
public $id;

/**
* @var Doctrine\Tests\Models\DDC\DDC2504OtherClass
* @var \Doctrine\Tests\Models\DDC2504\DDC2504OtherClass
*
* @ManyToOne(targetEntity="DDC2504OtherClass", inversedBy="childClasses")
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/DDC3293/DDC3293User.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DDC3293User
protected $id;

/**
* @var Doctrine\Tests\Models\DDC3293\DDC3293Address
* @var \Doctrine\Tests\Models\DDC3293\DDC3293Address
*/
protected $address;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DDC3293UserPrefixed
protected $id;

/**
* @var Doctrine\Tests\Models\DDC3293\DDC3293Address
* @var \Doctrine\Tests\Models\DDC3293\DDC3293Address
*/
protected $address;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Doctrine\Tests\ORM\Functional;

use Doctrine\Common\Collections\Collection;
use Doctrine\Tests\OrmFunctionalTestCase;

/**
* Base class for testing a many-to-many association mapping (without inheritance).
*/
class AbstractManyToManyAssociationTestCase extends \Doctrine\Tests\OrmFunctionalTestCase
class AbstractManyToManyAssociationTestCase extends OrmFunctionalTestCase
{
protected $_firstField;
protected $_secondField;
Expand Down
12 changes: 7 additions & 5 deletions tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

namespace Doctrine\Tests\ORM\Functional;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Query;
use Doctrine\Tests\OrmFunctionalTestCase;

/**
* Functional tests for the Single Table Inheritance mapping strategy.
*
* @author robo
*/
class AdvancedAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCase
class AdvancedAssociationTest extends OrmFunctionalTestCase
{
protected function setUp() {
parent::setUp();
Expand Down Expand Up @@ -151,7 +153,7 @@ class Lemma {
private $types;

public function __construct() {
$this->types = new \Doctrine\Common\Collections\ArrayCollection();
$this->types = new ArrayCollection();
}


Expand Down Expand Up @@ -257,7 +259,7 @@ class Type {
private $lemmas;

public function __construct(){
$this->lemmas = new \Doctrine\Common\Collections\ArrayCollection();
$this->lemmas = new ArrayCollection();
}

/**
Expand Down Expand Up @@ -372,7 +374,7 @@ class Phrase {
private $definitions;

public function __construct() {
$this->definitions = new \Doctrine\Common\Collections\ArrayCollection;
$this->definitions = new ArrayCollection;
}

/**
Expand Down Expand Up @@ -464,7 +466,7 @@ class PhraseType {
private $phrases;

public function __construct() {
$this->phrases = new \Doctrine\Common\Collections\ArrayCollection;
$this->phrases = new ArrayCollection;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
use Doctrine\Tests\Models\Company\CompanyEmployee,
Doctrine\Tests\Models\Company\CompanyManager,
Doctrine\Tests\Models\Company\CompanyCar;
use Doctrine\Tests\OrmFunctionalTestCase;

/**
* Functional Query tests.
*
* @author Benjamin <kontakt@beberlei.de>
*/
class AdvancedDqlQueryTest extends \Doctrine\Tests\OrmFunctionalTestCase
class AdvancedDqlQueryTest extends OrmFunctionalTestCase
{
protected function setUp()
{
Expand Down
43 changes: 24 additions & 19 deletions tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

namespace Doctrine\Tests\ORM\Functional;

use Doctrine\DBAL\Logging\DebugStack;
use Doctrine\ORM\EntityNotFoundException;
use Doctrine\ORM\Mapping\ClassMetadata;
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\OrmFunctionalTestCase;

class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
class BasicFunctionalTest extends OrmFunctionalTestCase
{
protected function setUp()
{
Expand Down Expand Up @@ -65,9 +70,9 @@ public function testBasicUnitsOfWorkWithOneToManyAssociation()
$this->assertFalse($this->_em->getUnitOfWork()->isScheduledForDelete($user));
$this->assertFalse($this->_em->getUnitOfWork()->isScheduledForDelete($ph));
$this->assertFalse($this->_em->getUnitOfWork()->isScheduledForDelete($ph2));
$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user));
$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($ph));
$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($ph2));
$this->assertEquals(UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user));
$this->assertEquals(UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($ph));
$this->assertEquals(UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($ph2));
}

public function testOneToManyAssociationModification()
Expand Down Expand Up @@ -146,26 +151,26 @@ public function testRemove()
$user->username = 'gblanco';
$user->status = 'developer';

$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW");
$this->assertEquals(UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW");

$this->_em->persist($user);

$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_MANAGED");
$this->assertEquals(UnitOfWork::STATE_MANAGED, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_MANAGED");

$this->_em->remove($user);

$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW");
$this->assertEquals(UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW");

$this->_em->persist($user);
$this->_em->flush();
$id = $user->getId();

$this->_em->remove($user);

$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_REMOVED, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_REMOVED");
$this->assertEquals(UnitOfWork::STATE_REMOVED, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_REMOVED");
$this->_em->flush();

$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_NEW, $this->_em->getUnitOfWork()->getEntityState($user), "State should be UnitOfWork::STATE_NEW");
$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));
}
Expand Down Expand Up @@ -565,7 +570,7 @@ public function testTextColumnSaveAndRetrieve()

$this->_em->persist($user);

$article = new \Doctrine\Tests\Models\CMS\CmsArticle();
$article = new CmsArticle();
$article->text = "Lorem ipsum dolor sunt.";
$article->topic = "A Test Article!";
$article->setAuthor($user);
Expand Down Expand Up @@ -608,7 +613,7 @@ public function testFlushDoesNotIssueUnnecessaryUpdates()
$address->user = $user;
$user->address = $address;

$article = new \Doctrine\Tests\Models\CMS\CmsArticle();
$article = new CmsArticle();
$article->text = "Lorem ipsum dolor sunt.";
$article->topic = "A Test Article!";
$article->setAuthor($user);
Expand All @@ -628,7 +633,7 @@ public function testFlushDoesNotIssueUnnecessaryUpdates()
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsAddress', $user2->address);

$oldLogger = $this->_em->getConnection()->getConfiguration()->getSQLLogger();
$debugStack = new \Doctrine\DBAL\Logging\DebugStack;
$debugStack = new DebugStack();
$this->_em->getConnection()->getConfiguration()->setSQLLogger($debugStack);

$this->_em->flush();
Expand Down Expand Up @@ -938,7 +943,7 @@ public function testMergeThrowsExceptionIfEntityWithGeneratedIdentifierDoesNotEx
try {
$this->_em->merge($user);
$this->fail();
} catch (\Doctrine\ORM\EntityNotFoundException $enfe) {}
} catch (EntityNotFoundException $enfe) {}
}

/**
Expand Down Expand Up @@ -995,7 +1000,7 @@ public function testManyToOneFetchModeQuery()
$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', \Doctrine\ORM\Mapping\ClassMetadata::FETCH_EAGER)
->setFetchMode('Doctrine\Tests\Models\CMS\CmsArticle', 'user', ClassMetadata::FETCH_EAGER)
->getSingleResult();
$this->assertInstanceOf('Doctrine\ORM\Proxy\Proxy', $article->user, "It IS a proxy, ...");
$this->assertTrue($article->user->__isInitialized__, "...but its initialized!");
Expand Down Expand Up @@ -1041,14 +1046,14 @@ public function testClearWithEntityName()

$this->_em->clear('Doctrine\Tests\Models\CMS\CmsUser');

$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($user));
$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($article1));
$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($article2));
$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_MANAGED, $unitOfWork->getEntityState($address));
$this->assertEquals(UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($user));
$this->assertEquals(UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($article1));
$this->assertEquals(UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($article2));
$this->assertEquals(UnitOfWork::STATE_MANAGED, $unitOfWork->getEntityState($address));

$this->_em->clear();

$this->assertEquals(\Doctrine\ORM\UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($address));
$this->assertEquals(UnitOfWork::STATE_DETACHED, $unitOfWork->getEntityState($address));
}

public function testFlushManyExplicitEntities()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Doctrine\Tests\ORM\Functional;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Tests\OrmFunctionalTestCase;

/**
* @group CascadeRemoveOrderTest
*/
class CascadeRemoveOrderTest extends \Doctrine\Tests\OrmFunctionalTestCase
class CascadeRemoveOrderTest extends OrmFunctionalTestCase
{
protected function setUp()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
Doctrine\Tests\Models\Company\CompanyRaffle;

use Doctrine\Common\Collections\Criteria;
use Doctrine\Tests\OrmFunctionalTestCase;

/**
* Functional tests for the Class Table Inheritance mapping strategy.
*
* @author robo
*/
class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
class ClassTableInheritanceTest extends OrmFunctionalTestCase
{
protected function setUp() {
protected function setUp()
{
$this->useModelSet('company');
parent::setUp();
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
Expand Down Expand Up @@ -80,7 +82,7 @@ public function testCRUD()
$query->setParameter(1, 'NewName', 'string');
$query->setParameter(2, 'NewDepartment');
$query->setParameter(3, 100000);
$query->getSql();
$query->getSQL();
$numUpdated = $query->execute();
$this->assertEquals(1, $numUpdated);

Expand Down
21 changes: 14 additions & 7 deletions tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<?php

namespace Doctrine\Tests\ORM\Functional;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Tests\OrmFunctionalTestCase;

/**
* Functional tests for the Class Table Inheritance mapping strategy.
*
* @author robo
*/
class ClassTableInheritanceTest2 extends \Doctrine\Tests\OrmFunctionalTestCase
class ClassTableInheritanceTest2 extends OrmFunctionalTestCase
{
protected function setUp() {
protected function setUp()
{
parent::setUp();
try {
$this->_schemaTool->createSchema(array(
Expand Down Expand Up @@ -156,19 +159,23 @@ class CTIRelated2
private $ctiChildren;


public function __construct() {
$this->ctiChildren = new \Doctrine\Common\Collections\ArrayCollection;
public function __construct()
{
$this->ctiChildren = new ArrayCollection();
}

public function getId() {
public function getId()
{
return $this->id;
}

public function addCTIChild(CTIChild $child) {
public function addCTIChild(CTIChild $child)
{
$this->ctiChildren->add($child);
}

public function getCTIChildren() {
public function getCTIChildren()
{
return $this->ctiChildren;
}
}
7 changes: 2 additions & 5 deletions tests/Doctrine/Tests/ORM/Functional/ClearEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@

use Doctrine\ORM\Event\OnClearEventArgs;
use Doctrine\ORM\Events;
use Doctrine\Tests\OrmFunctionalTestCase;

/**
* ClearEventTest
*
* @author Michael Ridgway <mcridgway@gmail.com>
*/
class ClearEventTest extends \Doctrine\Tests\OrmFunctionalTestCase
class ClearEventTest extends OrmFunctionalTestCase
{
protected function setUp() {
parent::setUp();
}

public function testEventIsCalledOnClear()
{
$listener = new OnClearListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use Doctrine\Tests\Models\Navigation\NavTour;
use Doctrine\Tests\Models\Navigation\NavPhotos;
use Doctrine\Tests\Models\Navigation\NavUser;
use Doctrine\Tests\OrmFunctionalTestCase;

class CompositePrimaryKeyTest extends \Doctrine\Tests\OrmFunctionalTestCase
class CompositePrimaryKeyTest extends OrmFunctionalTestCase
{
public function setUp()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
use Doctrine\Tests\Models\GeoNames\Country;
use Doctrine\Tests\Models\GeoNames\Admin1;
use Doctrine\Tests\Models\GeoNames\Admin1AlternateName;
use Doctrine\Tests\OrmFunctionalTestCase;

class CompositePrimaryKeyWithAssociationsTest extends \Doctrine\Tests\OrmFunctionalTestCase
class CompositePrimaryKeyWithAssociationsTest extends OrmFunctionalTestCase
{
public function setUp()
{
Expand Down
Loading

0 comments on commit b173763

Please sign in to comment.