public function testShouldApplyMoreThanOnePatches() { $deviceRepository = $this->deviceRepositoryBuilder->build(self::WURFL_FILE, array(self::PATCH_FILE_ONE, self::PATCH_FILE_TWO)); self::assertNotNull($deviceRepository); $newDevice1 = $deviceRepository->getDevice('generic_web_browser'); self::assertNotNull($newDevice1, 'generic web browser device is null'); self::assertEquals('770', $newDevice1->getCapability('columns')); $newDevice2 = $deviceRepository->getDevice('generic_web_browser_new'); self::assertNotNull($newDevice2, 'generic web browser device is null'); self::assertEquals('7', $newDevice2->getCapability('columns')); }
/** * This method is called before the first test of this test class is run. * * @since Method available since Release 3.4.0 */ public static function setUpBeforeClass() { $persistenceProvider = new Storage(new Memory()); $userAgentHandlerChain = UserAgentHandlerChainFactory::createFrom($persistenceProvider, $persistenceProvider); $devicePatcher = new DevicePatcher(); self::$deviceRepositoryBuilder = new DeviceRepositoryBuilder($persistenceProvider, $userAgentHandlerChain, $devicePatcher); try { self::$deviceRepository = self::$deviceRepositoryBuilder->build(self::RESOURCES_DIR . 'wurfl.xml'); } catch (Exception $e) { echo $e; } }
/** * This method is called before the first test of this test class is run. * * @since Method available since Release 3.4.0 */ public static function setUpBeforeClass() { $logger = new NullLogger(); $persistenceProvider = new Storage(new Memory()); $userAgentHandlerChain = UserAgentHandlerChainFactory::createFrom($persistenceProvider, $persistenceProvider, $logger); $devicePatcher = new DevicePatcher(); self::$deviceRepositoryBuilder = new DeviceRepositoryBuilder($persistenceProvider, $userAgentHandlerChain, $devicePatcher, $logger); try { self::$deviceRepository = self::$deviceRepositoryBuilder->build(self::WURFL_FILE); } catch (Exception $e) { echo $e; } }
/** * Initializes the WURFL Manager Factory by assigning cache and persistence providers */ private function init() { $devicePatcher = new Device\Xml\DevicePatcher(); $deviceRepositoryBuilder = new Device\DeviceRepositoryBuilder($this->getPersistenceStorage(), $this->getUserAgentHandlerChain(), $devicePatcher, $this->getLogger()); $this->deviceRepository = $deviceRepositoryBuilder->build($this->getWurflConfig()->wurflFile, $this->getWurflConfig()->wurflPatches, $this->getWurflConfig()->capabilityFilter); }