You are here

public function ProxyLogicTest::testCheckingPublicAssociationCausesLazyLoading in Plug 7

File

lib/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php, line 576

Class

ProxyLogicTest
Test the generated proxies behavior. These tests make assumptions about the structure of LazyLoadableObject

Namespace

Doctrine\Tests\Common\Proxy

Code

public function testCheckingPublicAssociationCausesLazyLoading() {
  $test = $this;
  $this
    ->configureInitializerMock(1, array(
    $this->lazyObject,
    '__isset',
    array(
      'publicAssociation',
    ),
  ), function () use ($test) {
    $test
      ->setProxyValue('publicPersistentField', 'newPersistentFieldValue');
    $test
      ->setProxyValue('publicAssociation', 'setPublicAssociation');
  });
  $this
    ->assertTrue(isset($this->lazyObject->publicAssociation));
  $this
    ->assertSame('setPublicAssociation', $this->lazyObject->publicAssociation);
  $this
    ->assertTrue(isset($this->lazyObject->publicPersistentField));
  $this
    ->assertSame('newPersistentFieldValue', $this->lazyObject->publicPersistentField);
}