Esempio n. 1
0
 public function testExecute()
 {
     $entityType = 'SomeNameSpace\\SomeClassName';
     $entity = ['name' => 'test'];
     $entityWithMainCreate = array_merge($entity, ['main' => 'info']);
     $this->createMainMock->expects($this->once())->method('execute')->with($entityType, $entity)->willReturn($entityWithMainCreate);
     $entityWithExtensions = array_merge($entityWithMainCreate, ['ext' => 'extInfo']);
     $this->createExtensionMock->expects($this->once())->method('execute')->with($entityType, $entityWithMainCreate)->willReturn($entityWithExtensions);
     $entityWithRelations = array_merge($entityWithExtensions, ['relations' => 'info']);
     $this->createRelationMock->expects($this->once())->method('execute')->with($entityType, $entityWithExtensions)->willReturn($entityWithRelations);
     $this->assertEquals($entityWithRelations, $this->create->execute($entityType, $entity));
 }