public function shouldNotUpdateVersionsHistoryWithWrongData() { $json = 'I am wrong json'; $bundle = new Bundle('KnpLabs/KnpMenuBundle'); $bundle->setComposerName('knplabs/knp-menu-bundle'); $httpClient = $this->getMockBuilder('Github\\HttpClient\\HttpClient')->setMethods(array('get'))->disableOriginalConstructor()->getMock(); $httpClient->expects($this->once())->method('get')->will($this->returnValue($json)); $githubRepo = $this->getRepo($httpClient); $githubRepo->updateVersionsHistory($bundle); $this->assertNull($bundle->getVersionsHistory()); }