/** * @param string $entityType * @param object $entity * @return object * @throws \Exception */ public function execute($entityType, $entity) { $entity = $this->createMain->execute($entityType, $entity); $entity = $this->createExtension->execute($entityType, $entity); $entity = $this->createRelation->execute($entityType, $entity); return $entity; }
public function testExecute() { $entityType = 'Type'; $entity = new \stdClass(); $action = $this->getMockBuilder(\stdClass::class)->disableOriginalConstructor()->setMethods(['execute'])->getMock(); $this->relationActionPoolMock->expects($this->once())->method('getActions')->with($entityType, 'create')->willReturn([$action]); $action->expects($this->once())->method('execute')->with($entityType, $entity)->willReturn($entity); $this->assertEquals($entity, $this->createRelation->execute($entityType, $entity)); }