Просмотр исходного кода

ZF-10595: ensure feature groups are serialized

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23232 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 15 лет назад
Родитель
Сommit
353d4497f6
2 измененных файлов с 22 добавлено и 0 удалено
  1. 8 0
      library/Zend/Http/UserAgent/AbstractDevice.php
  2. 14 0
      tests/Zend/Http/UserAgentTest.php

+ 8 - 0
library/Zend/Http/UserAgent/AbstractDevice.php

@@ -90,6 +90,13 @@ abstract class Zend_Http_UserAgent_AbstractDevice
     protected $_aFeatures = array();
 
     /**
+     * Browser/Device features groups
+     *
+     * @var array
+     */
+    protected $_aGroup = array();
+
+    /**
      * Constructor
      *
      * @param  null|string|array $userAgent If array, restores from serialized version
@@ -121,6 +128,7 @@ abstract class Zend_Http_UserAgent_AbstractDevice
     {
         $spec = array(
             '_aFeatures'      => $this->_aFeatures,
+            '_aGroup'         => $this->_aGroup,
             '_browser'        => $this->_browser,
             '_browserVersion' => $this->_browserVersion,
             '_userAgent'      => $this->_userAgent,

+ 14 - 0
tests/Zend/Http/UserAgentTest.php

@@ -551,4 +551,18 @@ class Zend_Http_UserAgentTest extends PHPUnit_Framework_TestCase
         $this->assertEquals('.foobar', $storage->getNamespace());
         $this->assertEquals('data', $storage->getMember());
     }
+
+    /**
+     * @group ZF-10595
+     */
+    public function testAGroupDefinedAndSerialized()
+    {
+        $config    = $this->config;
+        $userAgent = new Zend_Http_UserAgent($config);
+        $device    = $userAgent->getDevice();
+
+        $userAgent = unserialize(serialize($userAgent));
+        $device    = $userAgent->getDevice();
+        $groups = $device->getAllGroups();
+    }
 }