Example #1
0
 public function testGetFilePathBefore()
 {
     $Repo = new NbpRepository(self::$_NbpCache);
     $test_data = [[['2010-02-03', 'c'], 'c022z100202'], [['2010-02-03', 'h'], 'h022z100202'], [['2010-02-03', 'a'], 'a022z100202'], [['2010-02-03', 'b'], 'b004z100127'], [['2015-01-02', 'c'], 'c252z141231'], [['2015-01-02', 'h'], 'h252z141231'], [['2015-01-02', 'a'], 'a252z141231'], [['2015-01-02', 'b'], 'b052z141231'], [['2010-12-13', 'c'], 'c240z101210'], [['2010-12-13', 'h'], 'h240z101210'], [['2010-12-13', 'a'], 'a240z101210'], [['2010-12-13', 'b'], 'b049z101208']];
     foreach ($test_data as $data) {
         $date = $data[0][0];
         $table = $data[0][1];
         $expected = "http://www.nbp.pl/kursy/xml/{$data[1]}.xml";
         $actual = $Repo->getFilePathBefore($date, $table);
         $this->assertEquals($expected, $actual, "Failed with ({$date}, {$table})");
     }
 }