Bläddra i källkod

Removed WURFL UserAgent adapter

- Due to licensing changes, we have decided to remove the WURFL support from
  Zend Framework.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24694 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 14 år sedan
förälder
incheckning
dbbcb62b41

+ 0 - 5
documentation/manual/en/manual.xml.in

@@ -1149,11 +1149,6 @@
                     <xi:include href="../en/module_specs/Zend_Http_UserAgent-Features_Browscap.xml" />
                 </xi:fallback>
             </xi:include>
-            <xi:include href="module_specs/Zend_Http_UserAgent-Features_Wurfl.xml">
-                <xi:fallback>
-                    <xi:include href="../en/module_specs/Zend_Http_UserAgent-Features_Wurfl.xml" />
-                </xi:fallback>
-            </xi:include>
             <xi:include href="module_specs/Zend_Http_UserAgent-Features_DeviceAtlas.xml">
                 <xi:fallback>
                     <xi:include href="../en/module_specs/Zend_Http_UserAgent-Features_DeviceAtlas.xml" />

+ 3 - 4
documentation/manual/en/module_specs/Zend_Http_UserAgent-Features_Browscap.xml

@@ -117,16 +117,15 @@ $device = $userAgent->getDevice();
 
 $cssSupport    = $device->getFeature('cssversion');
 $jsSupport     = $device->getFeature('javascript');
-$cookieSupport = $device->getFeature('cookies');
 
 switch (true) {
-    case ($jsSupport && $cookieSupport && $cssSupport >= 3):
+    case ($jsSupport && $cssSupport >= 3):
         $layout->setLayout('layout-html5');
         break;
-    case ($jsSupport && $cookieSupport && $cssSupport < 3):
+    case ($jsSupport && $cssSupport < 3):
         $layout->setLayout('layout-xhtml');
         break;
-    case (!$jsSupport && $cookieSupport && $cssSupport < 3):
+    case (!$jsSupport && $cssSupport < 3):
         $layout->setLayout('layout-html-transitional');
         break;
     default:

+ 0 - 148
documentation/manual/en/module_specs/Zend_Http_UserAgent-Features_Wurfl.xml

@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Reviewed: no -->
-<sect1 id="zend.http.user-agent-features-wurfl">
-    <title>The WURFL UserAgent Features Adapter</title>
-
-    <sect2 id="zend.http.user-agent-features-wurfl.intro">
-        <title>Overview</title>
-
-        <para>
-            <ulink url="http://wurfl.sourceforge.net/">WURFL</ulink> (Wireless Universal Resource
-            File) is a database of mobile device capabilities. This class provides a <link
-                linkend="zend.http.user-agent-features">features adapter</link> that utilizes the
-            <acronym>WURFL</acronym> PHP API in order to discover mobile device capabilities to
-            inject into <classname>UserAgent</classname> device instances.
-        </para>
-    </sect2>
-
-    <sect2 id="zend.http.user-agent-features-wurfl.quick-start">
-        <title>Quick Start</title>
-
-        <para>
-            Please see the <link linkend="zend.http.user-agent.quick-start">Zend_Http_UserAgent
-                quick start</link> for an example.
-        </para>
-    </sect2>
-
-    <sect2 id="zend.http.user-agent-features-wurfl.options">
-        <title>Configuration Options</title>
-
-        <variablelist>
-            <title>WURFL API Options</title>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_api_version</term>
-
-                <listitem>
-                    <para>
-                        If using the <acronym>WURFL</acronym> API, use this key to specify which
-                        version you are using; typically, this will be either "1.0" or "1.1".
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_lib_dir</term>
-
-                <listitem>
-                    <para>
-                        If using the <acronym>WURFL</acronym> API, use this key to specify in which
-                        directory the library exists.
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_file</term>
-
-                <listitem>
-                    <para>
-                        If using the <acronym>WURFL</acronym> API, use this key to specify the
-                        location of the configuration file you will use; typically, this will be
-                        <filename>resources/wurfl-config.php</filename> within the
-                        <varname>wurfl_lib_dir</varname>.
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_array.wurfl.main-file</term>
-
-                <listitem>
-                    <para>
-                        If using version 1.1 of the <acronym>WURFL</acronym> API, you can omit using
-                        a <varname>wurfl_config_file</varname>, and instead provide an associative
-                        array of configuration values. This particular value indicates the location
-                        of the <filename>wurfl.xml</filename> file containing the actual
-                        <acronym>WURFL</acronym> database.
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_array.wurfl.patches[]</term>
-
-                <listitem>
-                    <para>
-                        If using version 1.1 of the <acronym>WURFL</acronym> API, you can omit using
-                        a <varname>wurfl_config_file</varname>, and instead provide an associative
-                        array of configuration values. This particular value is an array of file
-                        locations containing patchfiles for the <varname>wurfl.main-file</varname>
-                        (which are used to ammend and extend the primary database file).
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_array.persistence.provider</term>
-
-                <listitem>
-                    <para>
-                        If using version 1.1 of the <acronym>WURFL</acronym> API, you can omit using
-                        a <varname>wurfl_config_file</varname>, and instead provide an associative
-                        array of configuration values. This particular value indicates the type of
-                        persistence provider used when caching discovered capabilities. See the
-                        <acronym>WURFL</acronym> documentation for potential values; "file" is a
-                        known good value.
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_array.persistence.dir</term>
-
-                <listitem>
-                    <para>
-                        If using version 1.1 of the <acronym>WURFL</acronym> API, you can omit using
-                        a <varname>wurfl_config_file</varname>, and instead provide an associative
-                        array of configuration values. This particular value indicates the location
-                        where the persistence provider will cache discovered capabilities.
-                    </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </sect2>
-
-    <sect2 id="zend.http.user-agent-features-wurfl.methods">
-        <title>Available Methods</title>
-
-        <variablelist>
-            <varlistentry id="zend.http.user-agent-features-wurfl.methods.get-from-request">
-                <term>
-                    <methodsynopsis>
-                        <methodname>getFromRequest</methodname>
-                        <methodparam>
-                            <funcparams>array $request, array $config</funcparams>
-                        </methodparam>
-                    </methodsynopsis>
-                </term>
-
-                <listitem>
-                    <para>
-                        Decompose the request in order to return an array of device capabilities.
-                    </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </sect2>
-</sect1>

+ 38 - 198
documentation/manual/en/module_specs/Zend_Http_UserAgent.xml

@@ -93,18 +93,9 @@
             <listitem>
                 <para>
                     <link
-                        linkend="zend.http.user-agent-features-wurfl">Zend_Http_UserAgent_Features_Adapter_Wurfl</link>
-                    consumes the <ulink url="http://wurfl.sourceforge.net/">WURFL</ulink> (Wireless
-                    Universal Resource File) PHP API. This database is considered one of the most
-                    comprehensive mobile device capabilities databases available.
-                </para>
-            </listitem>
-
-            <listitem>
-                <para>
-                    <link
                         linkend="zend.http.user-agent-features-tera-wurfl">Zend_Http_UserAgent_Features_Adapter_TeraWurfl</link>
-                    consumes the TeraWurfl API, which is built on top of <acronym>WURFL</acronym>,
+                    consumes the TeraWurfl API, which is built on top of <ulink
+                        url="http://wurfl.sourceforge.net/"><acronym>WURFL</acronym></ulink>,
                     and aimed at providing a highly available, highly performant lookup mechanism.
                 </para>
             </listitem>
@@ -124,105 +115,56 @@
         <title>Quick Start</title>
 
         <para>
-            First, you will need to download the following:
+            First, you will need to download the <filename>php_browscap.ini</filename> if you do not
+            already have it installed on your system:
         </para>
 
         <itemizedlist>
             <listitem>
                 <para>
-                    The <acronym>WURFL</acronym> <ulink
-                        url="http://sourceforge.net/projects/wurfl/files/WURFL%20PHP/1.1/wurfl-php-1.1.tar.gz/download">PHP
-                        API</ulink>. This archive contains the most recent
-                    <filename>wurfl-latest.xml</filename> file and patches which constitute the
-                    actual <acronym>WURFL</acronym> database.
+                    <ulink url="http://browsers.garykeith.com/stream.asp?PHP_BrowsCapINI">php_browscap.ini</ulink>
                 </para>
             </listitem>
         </itemizedlist>
 
         <para>
-            We suggest that you inflate this archive in your "library" directory. Inflating the
-            archive will create a <filename>wurfl-php-1.1</filename> directory.
+            We suggest that you put the file in the same directory as your
+            <filename>php.ini</filename>.
         </para>
 
-        <programlisting language="text"><![CDATA[
-library
-|-- wurfl-php-1.1
-|   |-- COPYING
-|   |-- docs
-|   |-- examples
-|   |-- README
-|   |-- tests
-|   `-- WURFL
-]]></programlisting>
-
         <para>
-            Next, create a data and cache directory for the <acronym>WURFL</acronym> database and
-            related cache files; this should be done from your project root (the directory
-            containing the <filename>application</filename> and <filename>library</filename>
-            directories). When you do so, make sure the directory is at least writable by the web
-            server user; the following makes it writable for all users.
+            Next, notify PHP of the browscap file via the <varname>browscap</varname> setting.
+            Because this setting is of type <constant>PHP_INI_SYSTEM</constant>, this must be done
+            either in your <filename>php.ini</filename> or web server configuration; it cannot be
+            done in <filename>htaccess</filename> or via <function>ini_set()</function>. We
+            recommend adding it to your <filename>php.ini</filename>.
         </para>
 
-        <programlisting language="sh"><![CDATA[
-mkdir -p data/wurfl/cache
-chmod -R o+rwX data/wurfl/cache
-]]></programlisting>
-
-        <para>
-            Now, copy the <acronym>WURFL</acronym> data from the inflated archive into your data
-            directory.
-        </para>
-
-        <programlisting language="sh"><![CDATA[
-cp library/wurfl-php-1.1/tests/resources/wurfl-latest.zip data/wurfl/
-cp library/wurfl-php-1.1/tests/resources/web_browsers_patch.xml data/wurfl/
+        <programlisting language="ini"><![CDATA[
+browscap = /path/to/php_browscap.ini
 ]]></programlisting>
 
         <para>
-            Create a <acronym>WURFL</acronym> configuration file named
-            <filename>application/configs/wurfl-config.php</filename>, with the following contents:
+            If you put <varname>php_browscap.ini</varname> in the same directory as your
+            <filename>php.ini</filename>, this can be reduced to simply:
         </para>
 
-        <programlisting language="php"><![CDATA[
-$resourcesDir            = dirname(__FILE__) . '/../../data/wurfl/';
-
-$wurfl['main-file']      = $resourcesDir  . 'wurfl-latest.zip';
-$wurfl['patches']        = array($resourcesDir . 'web_browsers_patch.xml');
-
-$persistence['provider'] = 'file';
-$persistence['dir']      = $resourcesDir . 'cache/';
-
-$cache['provider']       = null;
-
-$configuration['wurfl']       = $wurfl;
-$configuration['persistence'] = $persistence;
-$configuration['cache']       = $cache;
+        <programlisting language="ini"><![CDATA[
+browscap = php_browscap.ini
 ]]></programlisting>
 
         <para>
-            Finally, edit your <filename>application.ini</filename> to add the following lines to your
+            Now, edit your <filename>application.ini</filename> to add the following lines to your
             <varname>[production]</varname> section:
         </para>
 
         <programlisting language="ini"><![CDATA[
-resources.useragent.wurflapi.wurfl_api_version = "1.1"
-resources.useragent.wurflapi.wurfl_lib_dir = APPLICATION_PATH "/../library/wurfl-php-1.1/WURFL/"
-resources.useragent.wurflapi.wurfl_config_file = APPLICATION_PATH "/configs/wurfl-config.php"
+resources.useragent.mobile.features.classname = "Zend_Http_UserAgent_Device_Features_Browscap"
 ]]></programlisting>
 
-        <note>
-            <para>
-                The trailing directory separator on the <constant>wurfl_lib_dir</constant> setting
-                is important. The <acronym>WURFL</acronym> API does no normalization, and expects
-                it to be there.
-            </para>
-        </note>
-
         <para>
-            At this point, everything is setup. The first request (from a mobile device) will populate the
-            <acronym>WURFL</acronym> cache by parsing the <filename>resources/wurfl.xml</filename>
-            file, and as such may take up to a minute. After that, lookups will be quite fast, and
-            each request will contain detailed information on the user agent.
+            At this point, everything is setup. Each request will contain detailed information on
+            the user agent.
         </para>
 
         <para>
@@ -261,23 +203,25 @@ $userAgent = $this->userAgent();
             capabilities.
         </para>
 
+        
         <programlisting language="php"><![CDATA[
-$width = $userAgent->getDevice()->getPhysicalScreenWidth();
+$device = $userAgent->getDevice();
+
+$cssSupport    = $device->getFeature('cssversion');
+$jsSupport     = $device->getFeature('javascript');
+
 switch (true) {
-    case ($width <= 128):
-        $layout->setLayout('layout-poor');
-        break;
-    case ($width <= 176):
-        $layout->setLayout('layout-medium');
+    case ($jsSupport && $cssSupport >= 3):
+        $layout->setLayout('layout-html5');
         break;
-    case ($width <= 240):
-        $layout->setLayout('layout-high');
+    case ($jsSupport && $cssSupport < 3):
+        $layout->setLayout('layout-xhtml');
         break;
-    case ($width <= 320):
-        $layout->setLayout('layout-ultra');
+    case (!$jsSupport && $cssSupport < 3):
+        $layout->setLayout('layout-html-transitional');
         break;
     default:
-        // use default
+        $layout->setLayout('layout-web-1');
         break;
 }
 ]]></programlisting>
@@ -285,7 +229,8 @@ switch (true) {
         <para>
             Finally, each device will often have a large number of capabilities not immediately
             represented in the device interface. You can query these using the
-            <methodname>hasFeature()</methodname> and <methodname>getFeature()</methodname> methods.
+            <methodname>hasFeature()</methodname> and <methodname>getFeature()</methodname> methods,
+            or simply grab all of them with <methodname>getAllFeatures()</methodname>.
         </para>
 
         <programlisting language="php"><![CDATA[
@@ -303,23 +248,9 @@ if ($userAgent->hasFeature('mp3') && $userAgent->getFeature('mp3')) {
 
             <para>
                 The following options may be passed to the constructor or within your application
-                configuration. A "." indicates another layer of depth in the configuration array; as
-                an example, assigning "wurflapi.wurfl_config_array.wurfl.main-file" as part of a PHP
-                configuration would require the following definition:
+                configuration. A "." indicates another layer of depth in the configuration array.
             </para>
 
-            <programlisting language="php"><![CDATA[
-$config = array(
-    'wurflapi' => array(
-        'wurfl_config_array' => array(
-            'wurfl' => array(
-                'main-file' => 'path/to/some/file',
-            ),
-        ),
-    ),
-);
-]]></programlisting>
-
             <para>
                 Each features adapter has its own options available as well, which may be mixed in
                 with the general UserAgent options.
@@ -491,97 +422,6 @@ resources.useragent.bot.device.prefix = "Mobile_Device"
                     </para>
                 </listitem>
             </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_api_version</term>
-
-                <listitem>
-                    <para>
-                        If using the <acronym>WURFL</acronym> API, use this key to specify which
-                        version you are using; typically, this will be either "1.0" or "1.1".
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_lib_dir</term>
-
-                <listitem>
-                    <para>
-                        If using the <acronym>WURFL</acronym> API, use this key to specify in which
-                        directory the library exists.
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_file</term>
-
-                <listitem>
-                    <para>
-                        If using the <acronym>WURFL</acronym> API, use this key to specify the
-                        location of the configuration file you will use; typically, this will be
-                        <filename>resources/wurfl-config.php</filename> within the
-                        <varname>wurfl_lib_dir</varname>.
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_array.wurfl.main-file</term>
-
-                <listitem>
-                    <para>
-                        If using version 1.1 of the <acronym>WURFL</acronym> API, you can omit using
-                        a <varname>wurfl_config_file</varname>, and instead provide an associative
-                        array of configuration values. This particular value indicates the location
-                        of the <filename>wurfl.xml</filename> file containing the actual
-                        <acronym>WURFL</acronym> database.
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_array.wurfl.patches[]</term>
-
-                <listitem>
-                    <para>
-                        If using version 1.1 of the <acronym>WURFL</acronym> API, you can omit using
-                        a <varname>wurfl_config_file</varname>, and instead provide an associative
-                        array of configuration values. This particular value is an array of file
-                        locations containing patchfiles for the <varname>wurfl.main-file</varname>
-                        (which are used to ammend and extend the primary database file).
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_array.persistence.provider</term>
-
-                <listitem>
-                    <para>
-                        If using version 1.1 of the <acronym>WURFL</acronym> API, you can omit using
-                        a <varname>wurfl_config_file</varname>, and instead provide an associative
-                        array of configuration values. This particular value indicates the type of
-                        persistence provider used when caching discovered capabilities. See the
-                        <acronym>WURFL</acronym> documentation for potential values; "file" is a
-                        known good value.
-                    </para>
-                </listitem>
-            </varlistentry>
-
-            <varlistentry>
-                <term>wurflapi.wurfl_config_array.persistence.dir</term>
-
-                <listitem>
-                    <para>
-                        If using version 1.1 of the <acronym>WURFL</acronym> API, you can omit using
-                        a <varname>wurfl_config_file</varname>, and instead provide an associative
-                        array of configuration values. This particular value indicates the location
-                        where the persistence provider will cache discovered capabilities.
-                    </para>
-                </listitem>
-            </varlistentry>
         </variablelist>
     </sect2>
 

+ 0 - 103
library/Zend/Http/UserAgent/Features/Adapter/WurflApi.php

@@ -1,103 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Http
- * @subpackage UserAgent
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-
-/**
- * Zend_Http_UserAgent_Features_Adapter_Interface
- */
-require_once 'Zend/Http/UserAgent/Features/Adapter.php';
-
-/**
- * Features adapter build with the official WURFL PHP API
- * See installation instruction here : http://wurfl.sourceforge.net/nphp/
- * Download : http://sourceforge.net/projects/wurfl/files/WURFL PHP/1.1/wurfl-php-1.1.tar.gz/download
- *
- * @package    Zend_Http
- * @subpackage UserAgent
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Http_UserAgent_Features_Adapter_WurflApi
-    implements Zend_Http_UserAgent_Features_Adapter
-{
-    const DEFAULT_API_VERSION = '1.1';
-
-    /**
-     * Get features from request
-     *
-     * @param  array $request $_SERVER variable
-     * @return array
-     */
-    public static function getFromRequest($request, array $config)
-    {
-        if (!isset($config['wurflapi'])) {
-            require_once 'Zend/Http/UserAgent/Features/Exception.php';
-            throw new Zend_Http_UserAgent_Features_Exception('"wurflapi" configuration is not defined');
-        }
-
-        $config = $config['wurflapi'];
-
-        if (empty($config['wurfl_lib_dir'])) {
-            require_once 'Zend/Http/UserAgent/Features/Exception.php';
-            throw new Zend_Http_UserAgent_Features_Exception('The "wurfl_lib_dir" parameter is not defined');
-        }
-        if (empty($config['wurfl_config_file']) && empty($config['wurfl_config_array'])) {
-            require_once 'Zend/Http/UserAgent/Features/Exception.php';
-            throw new Zend_Http_UserAgent_Features_Exception('The "wurfl_config_file" parameter is not defined');
-        }
-
-        if (empty($config['wurfl_api_version'])) {
-            $config['wurfl_api_version'] = self::DEFAULT_API_VERSION;
-        }
-
-        switch ($config['wurfl_api_version']) {
-            case '1.0':
-                // Zend_Http_UserAgent::$config['wurfl_config_file'] must be an XML file
-                require_once ($config['wurfl_lib_dir'] . 'WURFLManagerProvider.php');
-                $wurflManager = WURFL_WURFLManagerProvider::getWURFLManager(Zend_Http_UserAgent::$config['wurfl_config_file']);
-                break;
-            case '1.1':
-                require_once ($config['wurfl_lib_dir'] . 'Application.php');
-                if (!empty($config['wurfl_config_file'])) {
-                    $wurflConfig = WURFL_Configuration_ConfigFactory::create($config['wurfl_config_file']);
-                } elseif (!empty($config['wurfl_config_array'])) {
-                    $c            = $config['wurfl_config_array'];
-                    $wurflConfig  = new WURFL_Configuration_InMemoryConfig();
-                    $wurflConfig->wurflFile($c['wurfl']['main-file'])
-                                ->wurflPatch($c['wurfl']['patches'])
-                                ->persistence($c['persistence']['provider'], $c['persistence']['dir']);
-                }
-
-                $wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
-                $wurflManager = $wurflManagerFactory->create();
-                break;
-            default:
-                require_once 'Zend/Http/UserAgent/Features/Exception.php';
-                throw new Zend_Http_UserAgent_Features_Exception(sprintf(
-                    'Unknown API version "%s"',
-                    $config['wurfl_api_version']
-                ));
-        }
-
-        $device   = $wurflManager->getDeviceForHttpRequest(array_change_key_case($request, CASE_UPPER));
-        $features = $device->getAllCapabilities();
-        return $features;
-    }
-}

+ 2 - 2
library/Zend/Http/UserAgent/Mobile.php

@@ -33,9 +33,9 @@ require_once 'Zend/Http/UserAgent/AbstractDevice.php';
 class Zend_Http_UserAgent_Mobile extends Zend_Http_UserAgent_AbstractDevice
 {
 
-    const DEFAULT_FEATURES_ADAPTER_CLASSNAME = 'Zend_Http_UserAgent_Features_Adapter_WurflApi';
+    const DEFAULT_FEATURES_ADAPTER_CLASSNAME = 'Zend_Http_UserAgent_Features_Adapter_Browscap';
 
-    const DEFAULT_FEATURES_ADAPTER_PATH = 'Zend/Http/UserAgent/Features/Adapter/WurflApi.php';
+    const DEFAULT_FEATURES_ADAPTER_PATH = 'Zend/Http/UserAgent/Features/Adapter/Browscap.php';
 
     /**
      * User Agent Signatures

+ 4 - 2
tests/Zend/Http/UserAgent/AllTests.php

@@ -27,7 +27,8 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
 require_once 'Zend/Http/UserAgentTest.php';
 require_once 'Zend/Http/UserAgent/AbstractDeviceTest.php';
 require_once 'Zend/Http/UserAgent/Features/Adapter/BrowscapTest.php';
-require_once 'Zend/Http/UserAgent/Features/Adapter/WurflApiTest.php';
+require_once 'Zend/Http/UserAgent/Features/Adapter/DeviceAtlasTest.php';
+require_once 'Zend/Http/UserAgent/Features/Adapter/TeraWurflTest.php';
 
 /**
  * @category   Zend
@@ -51,7 +52,8 @@ class Zend_Http_UserAgent_AllTests
         $suite->addTestSuite('Zend_Http_UserAgentTest');
         $suite->addTestSuite('Zend_Http_UserAgent_AbstractDeviceTest');
         $suite->addTestSuite('Zend_Http_UserAgent_Features_Adapter_BrowscapTest');
-        $suite->addTestSuite('Zend_Http_UserAgent_Features_Adapter_WurflApiTest');
+        $suite->addTestSuite('Zend_Http_UserAgent_Features_Adapter_DeviceAtlasTest');
+        $suite->addTestSuite('Zend_Http_UserAgent_Features_Adapter_TeraWurflTest');
 
         return $suite;
     }

+ 0 - 65
tests/Zend/Http/UserAgent/Features/Adapter/WurflApiTest.php

@@ -1,65 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Http_UserAgent
- * @subpackage UnitTests
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-
-/**
- * Zend_Http_UserAgent
- */
-require_once 'Zend/Http/UserAgent.php';
-require_once 'Zend/Http/UserAgent/Features/Adapter/WurflApi.php';
-
-/** to generate the cache */
-set_time_limit(0);
-
-/**
- * @category   Zend
- * @package    Zend_Http_UserAgent
- * @subpackage UnitTests
- * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Http_UserAgent_Features_Adapter_WurflApiTest extends PHPUnit_Framework_TestCase
-{
-
-    public function setUp()
-    {
-        if (!constant('TESTS_ZEND_HTTP_USERAGENT_WURFL_LIB_DIR')
-            || !constant('TESTS_ZEND_HTTP_USERAGENT_WURFL_CONFIG_FILE')
-        ) {
-            $this->markTestSkipped('Requires WURFL library');
-        }
-        $this->config['wurflapi']['wurfl_lib_dir']     = constant('TESTS_ZEND_HTTP_USERAGENT_WURFL_LIB_DIR');
-        $this->config['wurflapi']['wurfl_config_file'] = constant('TESTS_ZEND_HTTP_USERAGENT_WURFL_CONFIG_FILE');
-    }
-
-    public function testGetFromRequest()
-    {
-        $request['http_user_agent'] = 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleW1ebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419.3';
-        $wurfl = Zend_Http_UserAgent_Features_Adapter_WurflApi::getFromRequest($request, $this->config);
-        $this->assertEquals('Safari', $wurfl['mobile_browser']);
-        $this->assertEquals('iPhone OS', $wurfl['device_os']);
-        $this->assertEquals('1.0', $wurfl['device_os_version']);
-        $this->assertEquals('true', $wurfl['has_qwerty_keyboard']);
-        $this->assertEquals('touchscreen', $wurfl['pointing_method']);
-        $this->assertEquals('false', $wurfl['is_tablet']);
-        $this->assertEquals('iPhone', $wurfl['model_name']);
-        $this->assertEquals('Apple', $wurfl['brand_name']);
-    }
-}

+ 15 - 16
tests/Zend/Http/UserAgentTest.php

@@ -66,10 +66,6 @@ class Zend_Http_UserAgentTest extends PHPUnit_Framework_TestCase
             'storage'               => array(
                 'adapter'           => 'NonPersistent',
             ),
-            'wurflapi'              => array(
-                'wurfl_lib_dir'     => constant('TESTS_ZEND_HTTP_USERAGENT_WURFL_LIB_DIR'),
-                'wurfl_config_file' => constant('TESTS_ZEND_HTTP_USERAGENT_WURFL_CONFIG_FILE'),
-            ),
         );
     }
 
@@ -115,23 +111,19 @@ class Zend_Http_UserAgentTest extends PHPUnit_Framework_TestCase
 
     public function testUserAgentDefineIdentificationSequence()
     {
-        if (!constant('TESTS_ZEND_HTTP_USERAGENT_WURFL_LIB_DIR')) {
-            $this->markTestSkipped('Depends on WURFL support');
+        $browscap = ini_get('browscap');
+        if (empty($browscap)) {
+            $this->markTestSkipped('Depends on browscap support');
         }
         $config = $this->config;
-        $config['user_agent'] = 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleW1ebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419.3';
+        $config['user_agent'] = 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419.3';
 
         $userAgent = new Zend_Http_UserAgent($config);
         $device    = $userAgent->getDevice();
         $this->assertType('Zend_Http_UserAgent_Mobile', $device);
         $this->assertEquals('mobile', $userAgent->getBrowserType());
-        $this->assertEquals('Safari', $userAgent->getDevice()->getFeature('mobile_browser'));
-        $this->assertEquals('iPhone OS', $userAgent->getDevice()->getFeature('device_os'));
-        $this->assertEquals('true', $userAgent->getDevice()->getFeature('has_qwerty_keyboard'));
-        $this->assertEquals('touchscreen', $userAgent->getDevice()->getFeature('pointing_method'));
-        $this->assertEquals('false', $userAgent->getDevice()->getFeature('is_tablet'));
-        $this->assertEquals('iPhone', $userAgent->getDevice()->getFeature('model_name'));
-        $this->assertEquals('Apple', $userAgent->getDevice()->getFeature('brand_name'));
+        $this->assertEquals('iPhone', $device->getFeature('mobile_browser'));
+        $this->assertRegexp('/iPhone/', $device->getFeature('device_os'));
     }
 
     public function testUserAgentDefineStorage()
@@ -191,8 +183,9 @@ class Zend_Http_UserAgentTest extends PHPUnit_Framework_TestCase
 
     public function testDeviceClassNameMatchesBrowserTypeIfUserAgentMatches()
     {
-        if (!constant('TESTS_ZEND_HTTP_USERAGENT_WURFL_LIB_DIR')) {
-            $this->markTestSkipped('Depends on WURFL support');
+        $browscap = ini_get('browscap');
+        if (empty($browscap)) {
+            $this->markTestSkipped('Depends on browscap support');
         }
         $this->config['browser_type'] = 'MoBiLe';
         $this->config['user_agent']   = 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleW1ebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419.3';
@@ -201,6 +194,9 @@ class Zend_Http_UserAgentTest extends PHPUnit_Framework_TestCase
         $this->assertEquals('Zend_Http_UserAgent_Mobile', $className);
     }
 
+    /**
+     * @runInSeparateProcess
+     */
     public function testDeviceClassNameMatchesDesktopTypeIfUserAgentDoesNotMatch()
     {
         $config = array(
@@ -538,6 +534,9 @@ class Zend_Http_UserAgentTest extends PHPUnit_Framework_TestCase
         $userAgent->setStorage(new Zend_Http_UserAgent_Storage_NonPersistent());
     }
 
+    /**
+     * @runInSeparateProcess
+     */
     public function testAllowsPassingStorageConfigurationOptions()
     {
         $config = $this->config;