Exemple #1
0
 public function testShouldClearAllItems()
 {
     $storage = new WURFL_Storage_Memory(array());
     $storage->save("key1", "item1");
     $storage->save("key2", "item2");
     $storage->clear();
     $this->assertThatNoElementsAreInCache(array("key1", "key2"), $storage);
 }
 public function testShouldNotRebuildTheRepositoryIfAlreadyBuild()
 {
     $persistenceProvider = new WURFL_Storage_Memory();
     $persistenceProvider->setWURFLLoaded(TRUE);
     $context = new WURFL_Context($persistenceProvider);
     $userAgentHandlerChain = WURFL_UserAgentHandlerChainFactory::createFrom($context);
     $devicePatcher = new WURFL_Xml_DevicePatcher();
     $deviceRepositoryBuilder = new WURFL_DeviceRepositoryBuilder($persistenceProvider, $userAgentHandlerChain, $devicePatcher);
     $this->assertNotNull($deviceRepositoryBuilder);
     $wurflFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . self::WURFL_FILE;
     try {
         $deviceRepository = $deviceRepositoryBuilder->build($wurflFile);
         $deviceRepository->getDevice("generic");
     } catch (Exception $ex) {
     }
 }