Пример #1
0
 /**
  * @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;
 }
Пример #2
0
 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));
 }
Пример #3
0
 public function testExecute()
 {
     $entityType = 'Type';
     $entity = new \stdClass();
     $entityData = ['name' => 'test'];
     $entityHydrator = $this->getMockBuilder(EntityHydrator::class)->disableOriginalConstructor()->getMock();
     $this->metadataPoolMock->expects($this->once())->method('getHydrator')->willReturn($entityHydrator);
     $entityHydrator->expects($this->once())->method('extract')->with($entity)->willReturn($entityData);
     $this->deleteEntityRowMock->expects($this->once())->method('execute')->with($entityType, $entityData)->willReturn($entity);
     $this->assertEquals($entity, $this->deleteMain->execute($entityType, $entity));
 }