/**
  * Return an instance of DailyConnectorInterface
  *
  * @return DailyConnectorInterface
  */
 public function getDailyConnector()
 {
     if (!isset($this->dailyConnector)) {
         $dailyConnector = new DailyConnector();
         $dailyConnector->setLock($this->getLock());
         $this->dailyConnector = $dailyConnector;
     }
     return $this->dailyConnector;
 }
 /**
  * Test that we can get the daily forecast using the json mode and
  * supplying an id
  */
 public function testDailyJsonUsingId()
 {
     $dailyConnector = new DailyConnector();
     $options = array('id' => 524901, 'mode' => 'json');
     $results = file_get_contents(__DIR__ . '/../../data/daily/json/524901.json');
     $mockResponse = $this->getMock('\\Zend\\Http\\Response');
     $mockResponse->expects($this->once())->method('isSuccess')->will($this->returnValue(true));
     $mockResponse->expects($this->once())->method('getBody')->will($this->returnValue($results));
     $mockClient = $this->getMock('\\Zend\\Http\\Client');
     $mockClient->expects($this->once())->method('dispatch')->with($this->isInstanceOf('\\Zend\\Http\\Request'))->will($this->returnValue($mockResponse));
     $mockLock = $this->getMock('\\OpenWeatherMap\\Lock\\LockInterface', array(), array(), 'mockLock', false);
     $mockLock->expects($this->once())->method('acquire')->will($this->returnValue(true));
     $mockLock->expects($this->once())->method('release')->will($this->returnValue(true));
     $dailyConnector->setHttpClient($mockClient);
     $dailyConnector->setLock($mockLock);
     $weatherData = $dailyConnector->getDaily($options);
     $this->assertInstanceOf('\\OpenWeatherMap\\Entity\\WeatherData', $weatherData);
     $location = $weatherData->getLocation();
     $this->assertInstanceOf('\\OpenWeatherMap\\Entity\\Location', $location);
     $this->assertEquals(524901, $location->getId());
     $this->assertEquals(1000000, $location->getPopulation());
 }