From 0748cc6f6f13254c65b8d63a9cf6c427813b2d70 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 6 Feb 2015 11:20:43 -0500
Subject: [PATCH] updated VuFindHttp

---
 composer.lock                                 | 10 +-
 vendor/autoload.php                           |  2 +-
 vendor/composer/autoload_real.php             |  8 +-
 vendor/composer/installed.json                | 12 +--
 .../src/VuFindHttp/HttpServiceAwareTrait.php  | 59 ++++++++++++
 .../VuFindTest/HttpServiceAwareTraitTest.php  | 94 +++++++++++++++++++
 6 files changed, 169 insertions(+), 16 deletions(-)
 create mode 100644 vendor/vufind-org/vufindhttp/src/VuFindHttp/HttpServiceAwareTrait.php
 create mode 100644 vendor/vufind-org/vufindhttp/tests/unit-tests/src/VuFindTest/HttpServiceAwareTraitTest.php

diff --git a/composer.lock b/composer.lock
index 6729efdc822..650e5e406ea 100644
--- a/composer.lock
+++ b/composer.lock
@@ -595,16 +595,16 @@
         },
         {
             "name": "vufind-org/vufindhttp",
-            "version": "v1.0.2",
+            "version": "v1.0.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/vufind-org/vufindhttp.git",
-                "reference": "2cd2f92cf2b43eb6a79bec0e895cb9c3d6e273d9"
+                "reference": "63b16b9c345b5e52eb3fa254abf9c3d260e92c87"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/vufind-org/vufindhttp/zipball/2cd2f92cf2b43eb6a79bec0e895cb9c3d6e273d9",
-                "reference": "2cd2f92cf2b43eb6a79bec0e895cb9c3d6e273d9",
+                "url": "https://api.github.com/repos/vufind-org/vufindhttp/zipball/63b16b9c345b5e52eb3fa254abf9c3d260e92c87",
+                "reference": "63b16b9c345b5e52eb3fa254abf9c3d260e92c87",
                 "shasum": ""
             },
             "require": {
@@ -637,7 +637,7 @@
             ],
             "description": "VuFind 2.x HTTP service library",
             "homepage": "http://vufind.org/",
-            "time": "2015-02-05 19:25:26"
+            "time": "2015-02-06 16:09:37"
         },
         {
             "name": "zendframework/zendframework",
diff --git a/vendor/autoload.php b/vendor/autoload.php
index e9168e0af41..aa11b61d89d 100644
--- a/vendor/autoload.php
+++ b/vendor/autoload.php
@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer' . '/autoload_real.php';
 
-return ComposerAutoloaderInitdb3b970d4f9b2549098ef1857fc2f1dd::getLoader();
+return ComposerAutoloaderInitb177c89eef09b489e2d5c8b83acacb55::getLoader();
diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php
index 13453f5b59b..2bed176b669 100644
--- a/vendor/composer/autoload_real.php
+++ b/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInitdb3b970d4f9b2549098ef1857fc2f1dd
+class ComposerAutoloaderInitb177c89eef09b489e2d5c8b83acacb55
 {
     private static $loader;
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInitdb3b970d4f9b2549098ef1857fc2f1dd
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInitdb3b970d4f9b2549098ef1857fc2f1dd', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInitb177c89eef09b489e2d5c8b83acacb55', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInitdb3b970d4f9b2549098ef1857fc2f1dd', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInitb177c89eef09b489e2d5c8b83acacb55', 'loadClassLoader'));
 
         $includePaths = require __DIR__ . '/include_paths.php';
         array_push($includePaths, get_include_path());
@@ -48,7 +48,7 @@ class ComposerAutoloaderInitdb3b970d4f9b2549098ef1857fc2f1dd
     }
 }
 
-function composerRequiredb3b970d4f9b2549098ef1857fc2f1dd($file)
+function composerRequireb177c89eef09b489e2d5c8b83acacb55($file)
 {
     require $file;
 }
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 28b21eb02e9..fa081367fea 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1165,17 +1165,17 @@
     },
     {
         "name": "vufind-org/vufindhttp",
-        "version": "v1.0.2",
-        "version_normalized": "1.0.2.0",
+        "version": "v1.0.3",
+        "version_normalized": "1.0.3.0",
         "source": {
             "type": "git",
             "url": "https://github.com/vufind-org/vufindhttp.git",
-            "reference": "2cd2f92cf2b43eb6a79bec0e895cb9c3d6e273d9"
+            "reference": "63b16b9c345b5e52eb3fa254abf9c3d260e92c87"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/vufind-org/vufindhttp/zipball/2cd2f92cf2b43eb6a79bec0e895cb9c3d6e273d9",
-            "reference": "2cd2f92cf2b43eb6a79bec0e895cb9c3d6e273d9",
+            "url": "https://api.github.com/repos/vufind-org/vufindhttp/zipball/63b16b9c345b5e52eb3fa254abf9c3d260e92c87",
+            "reference": "63b16b9c345b5e52eb3fa254abf9c3d260e92c87",
             "shasum": ""
         },
         "require": {
@@ -1184,7 +1184,7 @@
         "require-dev": {
             "zendframework/zend-uri": ">=2.2"
         },
-        "time": "2015-02-05 19:25:26",
+        "time": "2015-02-06 16:09:37",
         "type": "library",
         "installation-source": "dist",
         "autoload": {
diff --git a/vendor/vufind-org/vufindhttp/src/VuFindHttp/HttpServiceAwareTrait.php b/vendor/vufind-org/vufindhttp/src/VuFindHttp/HttpServiceAwareTrait.php
new file mode 100644
index 00000000000..cc854d54921
--- /dev/null
+++ b/vendor/vufind-org/vufindhttp/src/VuFindHttp/HttpServiceAwareTrait.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Default implementation of HttpServiceAwareInterface.
+ *
+ * PHP version 5
+ *
+ * Copyright (C) Villanova University 2015.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @category VuFind2
+ * @package  Http
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://github.com/dmj/vf2-proxy
+ */
+namespace VuFindHttp;
+
+/**
+ * Default implementation of HttpdServiceAwareInterface.
+ *
+ * @category VuFind2
+ * @package  Http
+ * @author   Demian Katz <demian.katz@villanova.edu>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://github.com/dmj/vf2-proxy
+ */
+trait HttpServiceAwareTrait
+{
+    /**
+     * HTTP service
+     *
+     * @var HttpServiceInterface
+     */
+    protected $httpService = null;
+
+    /**
+     * Set the HTTP service to be used for HTTP requests.
+     *
+     * @param HttpServiceInterface $service HTTP service
+     *
+     * @return void
+     */
+    public function setHttpService(HttpServiceInterface $service)
+    {
+        $this->httpService = $service;
+    }
+}
\ No newline at end of file
diff --git a/vendor/vufind-org/vufindhttp/tests/unit-tests/src/VuFindTest/HttpServiceAwareTraitTest.php b/vendor/vufind-org/vufindhttp/tests/unit-tests/src/VuFindTest/HttpServiceAwareTraitTest.php
new file mode 100644
index 00000000000..19bc7173843
--- /dev/null
+++ b/vendor/vufind-org/vufindhttp/tests/unit-tests/src/VuFindTest/HttpServiceAwareTraitTest.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * HttpServiceAwareTrait unit test.
+ *
+ * PHP version 5
+ *
+ * Copyright (C) Villanova University 2010.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @category Search
+ * @package  Service
+ * @author   David Maus <maus@hab.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://github.com/dmj/vf2-proxy
+ */
+namespace VuFindTest;
+
+/**
+ * Proxy service unit test.
+ *
+ * PHP version 5
+ *
+ * Copyright (C) Villanova University 2010.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * @category Search
+ * @package  Service
+ * @author   David Maus <maus@hab.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://github.com/dmj/vf2-proxy
+ */
+class HttpServiceAwareTraitTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * Test setter
+     *
+     * @return void
+     */
+    public function testSetHttpService()
+    {
+        $mock = $this->getMock('VuFindHttp\HttpService');
+        $test = new HttpServiceAwareTraitTestImplementation();
+        $test->setHttpService($mock);
+        $this->assertEquals($mock, $this->getProperty($test, 'httpService'));
+    }
+
+    /**
+     * Return protected or private property.
+     *
+     * Uses PHP's reflection API in order to modify property accessibility.
+     *
+     * @param object|string $object   Object or class name
+     * @param string        $property Property name
+     *
+     * @throws \ReflectionException Property does not exist
+     *
+     * @return mixed
+     */
+    protected function getProperty($object, $property)
+    {
+        $reflectionProperty = new \ReflectionProperty($object, $property);
+        $reflectionProperty->setAccessible(true);
+        return $reflectionProperty->getValue($object);
+    }
+}
+
+class HttpServiceAwareTraitTestImplementation
+{
+    use \VuFindHttp\HttpServiceAwareTrait;
+}
\ No newline at end of file
-- 
GitLab