/** * */ public function testCheckUpdateWithNewerVersion() { $logger = $this->getMock('\\Monolog\\Logger', array(), array(), '', false); $this->object->setLogger($logger); $loader = $this->getMock('\\BrowscapPHP\\Helper\\IniLoader', array('setRemoteFilename', 'setOptions', 'setLogger', 'load', 'getRemoteVersion'), array(), '', false); $loader->expects(self::once())->method('setRemoteFilename')->will(self::returnSelf()); $loader->expects(self::once())->method('setOptions')->will(self::returnSelf()); $loader->expects(self::once())->method('setLogger')->will(self::returnSelf()); $loader->expects(self::never())->method('load')->will(self::returnValue(false)); $loader->expects(self::once())->method('getRemoteVersion')->will(self::returnValue(6001)); $this->object->setLoader($loader); $map = array(array('browscap.time', false, null, null), array('browscap.version', false, null, 6000)); $cache = $this->getMock('\\BrowscapPHP\\Cache\\BrowscapCache', array('getItem', 'hasItem', 'setItem'), array(), '', false); $cache->expects(self::any())->method('getItem')->will(self::returnValueMap($map)); $cache->expects(self::any())->method('hasItem')->will(self::returnValue(true)); $cache->expects(self::never())->method('setItem')->will(self::returnValue(false)); $this->object->setCache($cache); self::assertSame(6000, $this->object->checkUpdate()); }