/** * @test */ public function getValuesWhenAParameterIsALL() { //when the user selects the option "Todos" for the destiny countries $sg = 1; $font = array(1, 2); $type = array(1, 3); $variety = array(1, 2); $origin = 1; $years = array(1990, 1991); $destiny = DatacenterRepository::ALL; $values = $this->daoRepository->getValuesWhenTheOptionAllWasSelected($sg, $variety, $type, $origin, $destiny, $font, $years); $this->assertEquals(450, $values->offsetGet(4)->getValue()); $this->assertEquals(200, $values->offsetGet(1)->getValue()); $this->assertEquals(150, $values->offsetGet(0)->getValue()); $this->assertEquals(400, $values->offsetGet(5)->getValue()); }
/** * * @param DataParam $params * @param array $years * @return ArrayIterator */ public function getValuesFilteringWithMultipleParams(DataParam $params, array $years) { if (is_array($params->getSubgroup())) { $subgroup = $params->getSubgroup(); $paramsForList1 = $params; $paramsForList1->setSubgroup($subgroup[0]); $listValues1 = $this->repository->getValuesWithMultipleParamsSelected($paramsForList1, $years); $paramsForList2 = $params; $paramsForList2->setSubgroup($subgroup[1]); $listValues2 = $this->repository->getValuesWithMultipleParamsSelected($paramsForList2, $years); $map = new HashMap(); $map->put(0, $listValues1); $map->put(1, $listValues2); return $map; } else { if ($params->theOptionAllHasBeenSelected()) { $listValues = $this->repository->getValuesWhenTheOptionAllWasSelected($params->getSubgroup(), $params->getVariety(), $params->getType(), $params->getOrigin(), $params->getDestiny(), $params->getFont(), $years); } else { $listValues = $this->repository->getValuesWithMultipleParamsSelected($params, $years); } return $listValues; } }