/** * {@inheritdoc} */ public function createWithCode() { $organization = $this->decoratedFactory->createWithCode(); if ($organization instanceof HierarchyInterface) { $organization->setParentDocument($this->documentManager->find(null, $this->rootPath)); } return $organization; }
public function it_creates_a_new_organization_with_code_and_parent_document(OrganizationFactoryInterface $factory, ObjectManager $documentManager) { $organization = new ParentTest(); $factory->createWithCode()->willReturn($organization); $documentManager->find(null, '/swp')->shouldBeCalled(); $this->createWithCode()->shouldHaveType(HierarchyInterface::class); }