コード例 #1
0
 public function setUp()
 {
     $resourcesDir = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . "../../resources");
     $config = new WURFL_Configuration_InMemoryConfig();
     $config->wurflFile($resourcesDir . "/wurfl_base.xml");
     // Setup WURFL Persistence
     $this->persistenceDir = sys_get_temp_dir() . '/api_test';
     WURFL_FileUtils::mkdir($this->persistenceDir);
     $config->persistence('file', array('dir' => $this->persistenceDir));
     // Setup Caching
     $config->cache('null');
     $wurflManagerFactory = new WURFL_WURFLManagerFactory($config);
     $this->wurflManager = $wurflManagerFactory->create();
 }
コード例 #2
0
 /**
  * Initializes the Persistence Dir
  *
  * @param array of parameters for configuring the Persistence Provider
  */
 function initialize($params)
 {
     if (is_array($params)) {
         if (!array_key_exists(self::DIR, $params)) {
             throw new WURFL_WURFLException("Specify a valid Persistence dir in the configuration file");
         }
         // Check if the directory exist and it is also write access
         if (!is_writable($params[self::DIR])) {
             throw new WURFL_WURFLException("The diricetory specified <" . $params[self::DIR] . "> for the persistence provider does not exist or it is not writable\n");
         }
         $this->_persistenceDir = $params[self::DIR] . DIRECTORY_SEPARATOR . $this->persistenceIdentifier;
         WURFL_FileUtils::mkdir($this->_persistenceDir);
     }
 }
コード例 #3
0
 function __construct($params)
 {
     if (is_array($params)) {
         if (!array_key_exists(self::DIR, $params)) {
             throw new WURFL_WURFLException("Specify a valid cache dir in the configuration file");
         }
         // Check if the directory exist and it is also write access
         if (!is_writable($params[self::DIR])) {
             throw new WURFL_WURFLException("The diricetory specified <" . $params[self::DIR] . " > for the cache provider does not exist or it is not writable\n");
         }
         $this->_cacheDir = $params[self::DIR] . DIRECTORY_SEPARATOR . $this->cacheIdentifier;
         $this->root = $params[self::DIR] . DIRECTORY_SEPARATOR . $this->cacheIdentifier;
         $this->expire = isset($params[WURFL_Cache_CacheProvider::EXPIRATION]) ? $params[WURFL_Cache_CacheProvider::EXPIRATION] : WURFL_Cache_CacheProvider::NEVER;
         WURFL_FileUtils::mkdir($this->_cacheDir);
     }
 }
コード例 #4
0
ファイル: FileTest.php プロジェクト: acasademont/wurfl
 public function setUp()
 {
     WURFL_FileUtils::mkdir(self::storageDir());
 }
コード例 #5
0
 public function setUp()
 {
     WURFL_FileUtils::mkdir($this->cacheDir());
 }