/**
  * @test
  */
 public function correctFormat()
 {
     $file = __DIR__ . "/Teste.xls";
     $this->spreadsheetReader = new Spreadsheet_Excel_Reader($file);
     $this->inputFile = new ExcelInputFile($this->spreadsheetReader);
     $values = $this->inputFile->getYears();
     $this->assertEquals(4, sizeof($values));
     $values = $this->inputFile->getValuesFromACountry("Brasil");
     $this->assertTrue($this->associativeArrayEquals($this->expectedValuesFromACountry(), $values));
 }
 public function linesWithValuesAreCorrect()
 {
     $allLines = $this->excelInputFile->allTheLinesButTheFirst();
     foreach ($allLines as $line) {
         if (!is_string($line[1])) {
             return false;
         }
         if (!$this->lineNumberPatterns($line)) {
             return false;
         }
         array_shift($line);
         if (sizeof($line) > sizeof($this->excelInputFile->getYears())) {
             return false;
         }
     }
     return true;
 }
 private function insertValuesIfACountryDoesNotHaveItStoredYet(ArrayIterator $dataValues, ExcelInputFile $excelInputFile, $country)
 {
     $yearsToInsert = new ArrayObject();
     $i = 0;
     foreach ($excelInputFile->getYears() as $year) {
         if (!$this->thisYearIsAlreadyStored($dataValues, $year)) {
             $yearsToInsert->append($year);
         }
     }
     return $yearsToInsert;
 }