function it_set_initialization_callback_to_lazy_properties(LazyProperty $lazyProperty) { $entity = new EntityFake(); $proxy = new ProxyFake($entity, [$lazyProperty->getWrappedObject()]); $this->register($proxy); $lazyProperty->setInitializationCallback(Argument::type('Isolate\Framework\UnitOfWork\LazyObjects\InitializationCallback')) ->shouldHaveBeenCalled(); $this->isRegistered($entity)->shouldReturn(true); }
/** * @param mixed $defaultValue * @param mixed $newValue * @param mixed $targetObject */ public function execute($defaultValue, $newValue, $targetObject) { $newValueSnapshot = $this->snapshotMaker->makeSnapshotOf($newValue); $this->propertyAccessor->setValue($this->snapshot, (string) $this->lazyProperty->getName(), $newValueSnapshot); }