/**
  * @test
  */
 public function it_fetches_a_rate()
 {
     $url = 'http://www.google.com/finance/converter?a=1&from=EUR&to=USD';
     $content = file_get_contents(__DIR__ . '/../../Fixtures/Provider/GoogleFinance/success.html');
     $provider = new GoogleFinanceProvider($this->getHttpAdapterMock($url, $content));
     $rate = $provider->fetchRate(new CurrencyPair('EUR', 'USD'));
     $this->assertSame('1.1825', $rate->getValue());
     $this->assertInstanceOf('\\DateTime', $rate->getDate());
 }
 /**
  * @test
  */
 public function it_fetches_a_rate()
 {
     $url = 'http://www.google.com/finance/converter?a=1&from=EUR&to=USD';
     $content = file_get_contents(__DIR__ . '/../../Fixtures/Provider/GoogleFinance/success.html');
     $body = $this->getMock('Psr\\Http\\Message\\StreamInterface');
     $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 GoogleFinanceProvider($adapter);
     $rate = $provider->fetchRate(new CurrencyPair('EUR', 'USD'));
     $this->assertSame('1.1825', $rate->getValue());
     $this->assertInstanceOf('\\DateTime', $rate->getDate());
 }