Skip to content

Commit

Permalink
Testing against the new GhostObjectInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Jan 30, 2016
1 parent 957986a commit e437ec4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\UnitOfWork;
use ProxyManager\Proxy\GhostObjectInterface;

/**
* @group DDC-1452
Expand Down Expand Up @@ -46,7 +47,7 @@ public function testIssue()
$results = $this->_em->createQuery($dql)->setMaxResults(1)->getResult();

$this->assertSame($results[0], $results[0]->entitiesB[0]->entityAFrom);
$this->assertFalse( $results[0]->entitiesB[0]->entityATo instanceof \Doctrine\ORM\Proxy\Proxy );
$this->assertFalse($results[0]->entitiesB[0]->entityATo instanceof GhostObjectInterface);
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $results[0]->entitiesB[0]->entityATo->getEntitiesB());
}

Expand Down Expand Up @@ -74,12 +75,12 @@ public function testFetchJoinOneToOneFromInverse()
$data = $this->_em->createQuery($dql)->getResult();
$this->_em->clear();

$this->assertFalse($data[0]->user instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertFalse($data[0]->user instanceof GhostObjectInterface);

$dql = "SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.address a";
$data = $this->_em->createQuery($dql)->getResult();

$this->assertFalse($data[0]->address instanceof \Doctrine\ORM\Proxy\Proxy);
$this->assertFalse($data[0]->address instanceof GhostObjectInterface);
}
}

Expand Down
5 changes: 4 additions & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2231Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public function testInjectObjectManagerInProxyIfInitializedInUow()

$id = $y1ref->doSomething();

$this->assertTrue($y1ref->isProxyInitialized());
$this->assertFalse($y1ref->isProxyInitialized());

$y1ref->initializeProxy();

$this->assertEquals($this->_em, $y1ref->om);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testIssue()

/* @var $address DDC2306Address */
$address = $this->_em->find(__NAMESPACE__ . '\\DDC2306Address', $address->id);
/* @var $user DDC2306User|\Doctrine\ORM\Proxy\Proxy */
/* @var $user DDC2306User|GhostObjectInterface */
$user = $address->users->first()->user;

$this->assertInstanceOf(GhostObjectInterface::class, $user);
Expand Down

0 comments on commit e437ec4

Please sign in to comment.