/** * @param string $entityType * @param object $entity * @return true * @throws \Exception */ public function execute($entityType, $entity) { $this->deleteRelation->execute($entityType, $entity); $this->deleteExtension->execute($entityType, $entity); $this->deleteMain->execute($entityType, $entity); return true; }
public function testExecute() { $entityType = 'SomeNameSpace\\SomeClassName'; $entity = ['name' => 'test']; $this->deleteMainMock->expects($this->once())->method('execute')->with($entityType, $entity); $this->deleteExtensionMock->expects($this->once())->method('execute')->with($entityType, $entity); $this->deleteRelationMock->expects($this->once())->method('execute')->with($entityType, $entity); $this->assertTrue($this->delete->execute($entityType, $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, 'delete')->willReturn([$action]); $action->expects($this->once())->method('execute')->with($entityType, $entity)->willReturn($entity); $this->assertEquals($entity, $this->deleteRelation->execute($entityType, $entity)); }