コード例 #1
0
ファイル: UserAgentsTest.php プロジェクト: browscap/browscap
 /**
  * This method is called before the first test of this test class is run.
  */
 public static function setUpBeforeClass()
 {
     // First, generate the INI files
     $buildNumber = time();
     $resourceFolder = __DIR__ . '/../../resources/';
     self::$buildFolder = __DIR__ . '/../../build/browscap-ua-test-' . $buildNumber . '/build/';
     $cacheFolder = __DIR__ . '/../../build/browscap-ua-test-' . $buildNumber . '/cache/';
     // create build folder if it does not exist
     if (!file_exists(self::$buildFolder)) {
         mkdir(self::$buildFolder, 0777, true);
     }
     if (!file_exists($cacheFolder)) {
         mkdir($cacheFolder, 0777, true);
     }
     $logger = new Logger('browscap');
     $logger->pushHandler(new NullHandler(Logger::DEBUG));
     $buildGenerator = new BuildGenerator($resourceFolder, self::$buildFolder);
     $writerCollectionFactory = new PhpWriterFactory();
     $writerCollection = $writerCollectionFactory->createCollection($logger, self::$buildFolder);
     $buildGenerator->setLogger($logger)->setCollectionCreator(new CollectionCreator())->setWriterCollection($writerCollection);
     $buildGenerator->run($buildNumber, false);
     $cache = new File([File::DIR => $cacheFolder]);
     self::$browscap = new Browscap();
     self::$browscap->setCache($cache)->setLogger($logger);
     self::$browscapUpdater = new BrowscapUpdater();
     self::$browscapUpdater->setCache($cache)->setLogger($logger);
     self::$propertyHolder = new PropertyHolder();
 }
コード例 #2
0
ファイル: UserAgentsTest.php プロジェクト: prox2k/browscap
 /**
  * This method is called before the first test of this test class is run.
  */
 public static function setUpBeforeClass()
 {
     // First, generate the INI files
     $buildNumber = time();
     $resourceFolder = __DIR__ . '/../../resources/';
     self::$buildFolder = __DIR__ . '/../../build/browscap-ua-test-' . $buildNumber;
     // create build folder if it does not exist
     if (!file_exists(self::$buildFolder)) {
         mkdir(self::$buildFolder, 0777, true);
     }
     $logger = new Logger('browscap');
     $logger->pushHandler(new NullHandler(Logger::DEBUG));
     $buildGenerator = new BuildGenerator($resourceFolder, self::$buildFolder);
     $writerCollectionFactory = new PhpWriterFactory();
     $writerCollection = $writerCollectionFactory->createCollection($logger, self::$buildFolder);
     $buildGenerator->setLogger($logger)->setCollectionCreator(new CollectionCreator())->setWriterCollection($writerCollection);
     $buildGenerator->run('test', false);
     // Now, load an INI file into phpbrowscap\Browscap for testing the UAs
     self::$browscap = new Browscap(self::$buildFolder);
     self::$propertyHolder = new PropertyHolder();
 }