/**
  * @test
  */
 public function doNotInsertWhenValuesAreadyExist()
 {
     $countryMap = new CountryMap();
     $service = new DatacenterService($this->dao, $countryMap);
     $service->insertValues($this->inputFile, 1, 1, 1, 1, 1);
     $dataParam = new DataParam(1, 1, 1, 1, 1, 1);
     $this->assertEquals(2, $service->getValuesWithSimpleFilter($dataParam)->count());
     $this->emptyDatabase();
     $file = __DIR__ . "/Teste.xls";
     $this->spreadsheetReader = new Spreadsheet_Excel_Reader($file);
     $this->inputFile->setNewSpreadsheet($this->spreadsheetReader);
     $service->insertValues($this->inputFile, 1, 1, 1, 1, 1);
     $dataParam_2 = new DataParam(1, 1, 1, 1, 1, 1);
     $this->assertEquals(4, $service->getValuesWithSimpleFilter($dataParam_2)->count());
 }
 public function getValuesWithSimpleParams(DataParam $params, array $years)
 {
     $values = $this->datacenterService->getValuesWithSimpleFilter($params, $years);
     if ($this->asJson) {
         return $this->toJson($values);
     }
     return $values;
 }
 /**     
  * @test
  */
 public function serviceGetValuesOfExportFromBrazilToUSAOfGreenArabicCoffe()
 {
     $this->repository->expects($this->any())->method('getValuesFromAGroup')->will($this->returnValue(0));
     $this->repository->expects($this->any())->method('getValuesWithSimpleFilter')->will($this->returnValue($this->listFilteredByOneSubgroup()));
     $subgroup = $variety = $type = $origin = $destiny = $font = array(1);
     //$this->assertEquals(3, $this->repository->getValuesByOneSubgroup($subgroup, $variety, $type, $origin, $destiny, $font)->count());
     $dataParam = new DataParam($subgroup, $font, $type, $variety, $origin, $destiny);
     $this->assertEquals(3, $this->service->getValuesWithSimpleFilter($dataParam, array("ano1", "ano2"))->count());
 }