/** * @test */ public function documentReceivedForDateInPast() { $browser = new BancaIntesaBrowser(); $htmlDoc = $browser->getHtmlDocument(new \DateTime('2016-01-01')); $supported = array('EUR', 'AUD', 'ATS', 'BEF', 'CAD', 'CNY', 'HRK', 'CZK', 'DKK', 'FIM', 'FRF', 'DEM', 'GRD', 'HUF', 'IEP', 'ITL', 'JPY', 'KWD', 'LUF', 'NOK', 'PTE', 'RUB', 'SKK', 'ESP', 'SEK', 'CHF', 'GBP', 'USD', 'BAM', 'PLN'); foreach ($supported as $cc) { $this->assertContains($cc, $htmlDoc, sprintf('Should contain column with currency code "%s".', $cc)); } }
/** * Load rates from Banca Intesa Serbia website. * * @param \DateTime $date * @return RateInterface[] * @throws SourceNotAvailableException */ private function load(\DateTime $date) { $parser = new HtmlParser($this->browser->getHtmlDocument($date), $date); foreach ($parser->getRates() as $rate) { if (!array_key_exists($rate->getRateType(), $this->cache)) { $this->cache[$rate->getRateType()] = array(); } $this->cache[$rate->getRateType()][$rate->getCurrencyCode()] = $rate; } }