/**
  * @test
  */
 public function it_fetches_a_rate()
 {
     $url = 'https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';
     $content = file_get_contents(__DIR__ . '/../../Fixtures/Provider/EuropeanCentralBank/success.xml');
     $provider = new EuropeanCentralBankProvider($this->getHttpAdapterMock($url, $content));
     $rate = $provider->fetchRate(new CurrencyPair('EUR', 'BGN'));
     $this->assertSame('1.9558', $rate->getValue());
     $this->assertEquals(new \DateTime('2015-01-07'), $rate->getDate());
 }
 /**
  * @test
  */
 public function it_fetches_a_rate()
 {
     $url = 'https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';
     $content = file_get_contents(__DIR__ . '/../../Fixtures/Provider/EuropeanCentralBank/success.xml');
     $body = $this->getMock('Psr\\Http\\Message\\StreamableInterface');
     $body->expects($this->once())->method('__toString')->will($this->returnValue($content));
     $response = $this->getMock('\\Ivory\\HttpAdapter\\Message\\ResponseInterface');
     $response->expects($this->once())->method('getBody')->will($this->returnValue($body));
     $adapter = $this->getMock('Ivory\\HttpAdapter\\HttpAdapterInterface');
     $adapter->expects($this->once())->method('get')->with($url)->will($this->returnValue($response));
     $provider = new EuropeanCentralBankProvider($adapter);
     $rate = $provider->fetchRate(new CurrencyPair('EUR', 'BGN'));
     $this->assertSame('1.9558', $rate->getValue());
     $this->assertEquals(new \DateTime('2015-01-07'), $rate->getDate());
 }