Exemplo n.º 1
0
 public function testUpdateModelAndInsertRepetitionAndCost()
 {
     $dataCost = array('id' => NULL, 'person_type' => 'member', 'amount' => '44');
     $dataRepetition = array('id' => NULL, 'repetition_parameter' => 'weeks', 'day_of_week' => 'Tuesday', 'day_of_month' => '', 'month_of_year' => '');
     $costModel = $this->getMockCostsMapper()->createModelFromData($dataCost);
     $repetitionModel = $this->getMockRepetitionsMapper()->createModelFromData($dataRepetition);
     $dataEvent = array('id' => '34', 'repetitions' => [$repetitionModel], 'costs' => [$costModel, $costModel]);
     $personModel = $this->getMockPeopleMapper()->createModelFromData($dataEvent);
     $this->getMockCostsMapper()->shouldReceive('insertModel')->with($costModel)->andReturnNull()->twice();
     $this->getMockRepetitionsMapper()->shouldReceive('insertModel')->with($repetitionModel)->andReturnNull()->once();
     $this->getMockPeopleMapper()->shouldReceive('updateModel')->with($personModel)->once();
     $returnedProcessResult = $this->peopleProcess->updateModel($personModel);
     $this->assertEquals($this->getProcessResultSuccess(), $returnedProcessResult);
 }