/** * After load * * @param LifecycleEventArgs $args */ public function postLoad(LifecycleEventArgs $args) { $object = $args->getObject(); if (!$object instanceof ProductInterface) { return; } if ($this->context->hasScopeCode()) { $object->setScope($this->context->getScopeCode()); } }
function it_does_not_configure_scope_for_other_objects(CatalogContext $context, LifecycleEventArgs $args) { $object = new \stdClass(); $args->getObject()->willReturn($object); $context->hasScopeCode()->willReturn(true); $context->getScopeCode()->shouldNotBeCalled(); $this->postLoad($args); }