public function testGetUrl() { $Loader = new NbpDirLoader(); $data_set = ["2015" => "http://www.nbp.pl/kursy/xml/dir2015.txt", "" => "http://www.nbp.pl/kursy/xml/dir.txt", "2014" => "http://www.nbp.pl/kursy/xml/dir2014.txt", "2013" => "http://www.nbp.pl/kursy/xml/dir2013.txt"]; foreach ($data_set as $key => $expected) { $this->assertEquals($expected, $Loader->getUrl($key)); } }
/** * @param null|string $date * @return array */ public function getDir($date = null) { $year = substr($date, 0, 4); $dir = $this->_NbpCache->tryGet($year); if (empty($dir)) { $DirLoader = new Service\NbpDirLoader(); $dir = $DirLoader->load($year); $this->_NbpCache->set($year, $dir); } return $dir; }