Esempio n. 1
0
 /**
  * @expectedException \BrowscapPHP\Helper\Exception
  * @expectedExceptionMessage could not load the data file
  */
 public function testLoadException()
 {
     $loader = $this->getMock('\\FileLoader\\Loader', array('load', 'setRemoteDataUrl', 'setRemoteVerUrl', 'setTimeout'), array(), '', false);
     $loader->expects(self::once())->method('load')->will(self::throwException(new LoaderException()));
     $loader->expects(self::once())->method('setRemoteDataUrl')->will(self::returnSelf());
     $loader->expects(self::once())->method('setRemoteVerUrl')->will(self::returnSelf());
     $loader->expects(self::once())->method('setTimeout')->will(self::returnSelf());
     $this->object->setLoader($loader);
     $logger = $this->getMock('\\Monolog\\Logger', array(), array(), '', false);
     $this->object->setLogger($logger);
     $this->object->load();
 }
Esempio n. 2
0
 /**
  * reads and parses an ini file and writes the results into the cache
  *
  * @param  string $iniFile
  *
  * @throws \BrowscapPHP\Exception
  */
 public function convertFile($iniFile)
 {
     $loader = new IniLoader();
     try {
         $loader->setLocalFile($iniFile);
     } catch (Helper\Exception $e) {
         throw new Exception('an error occured while setting the local file', 0, $e);
     }
     try {
         $iniString = $loader->load();
     } catch (Helper\Exception $e) {
         throw new Exception('an error occured while converting the local file into the cache', 0, $e);
     }
     $this->convertString($iniString);
 }