You are here

public function ProxyLogicTest::testSettingPublicFieldsCausesLazyLoading in Plug 7

File

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

Class

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

Namespace

Doctrine\Tests\Common\Proxy

Code

public function testSettingPublicFieldsCausesLazyLoading() {
  $test = $this;
  $this
    ->configureInitializerMock(1, array(
    $this->lazyObject,
    '__set',
    array(
      'publicPersistentField',
      'newPublicPersistentFieldValue',
    ),
  ), function () use ($test) {
    $test
      ->setProxyValue('publicPersistentField', 'overrideValue');
    $test
      ->setProxyValue('publicAssociation', 'newAssociationValue');
  });
  $this->lazyObject->publicPersistentField = 'newPublicPersistentFieldValue';
  $this
    ->assertSame('newPublicPersistentFieldValue', $this->lazyObject->publicPersistentField);
  $this
    ->assertSame('newAssociationValue', $this->lazyObject->publicAssociation);
}