public function testInsertModel() { $dataCost = array('person_type' => 'member', 'amount' => '44'); $dataRepetition = array('repetition_parameter' => 'months', 'day_of_week' => 'Wednesday', 'day_of_month' => '1', 'month_of_year' => ''); $costModel = $this->getMockCostsMapper()->createModelFromData($dataCost); $repetitionModel = $this->getMockRepetitionsMapper()->createModelFromData($dataRepetition); $data = array('id' => NULL, 'venue_id' => '22', 'costs' => [$costModel], 'repetitions' => [$repetitionModel, $repetitionModel]); $personModel = $this->getMockPeopleMapper()->createModelFromData($data); $this->getMockPeopleMapper()->shouldReceive('insertModel')->with($personModel)->andReturn($personModel)->once(); $this->getMockRepetitionsMapper()->shouldReceive('insertModel')->with($this->compareModel($repetitionModel))->andReturn($repetitionModel)->twice(); $this->getMockCostsMapper()->shouldReceive('insertModel')->with($this->compareModel($costModel))->andReturn($costModel)->once(); $this->getMockSessionPeopleMapper()->shouldReceive('delete')->withNoArgs()->andReturnNull()->once(); $returnedProcessResult = $this->peopleProcess->insertModel($personModel); $this->assertEquals($this->getProcessResultSuccess(), $returnedProcessResult); }