Permalink
Browse files

Remove additional http class.

  • Loading branch information...
1 parent 48ee095 commit 870abf644ba52fac79f35b4ec29f500ae11cce4d @aaronschmitz aaronschmitz committed with LouisLandry Oct 10, 2012
View
36 libraries/joomla/oauth/http.php
@@ -1,36 +0,0 @@
-<?php
-/**
- * @package Joomla.Platform
- * @subpackage Oauth
- *
- * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE
- */
-
-defined('JPATH_PLATFORM') or die;
-
-/**
- * HTTP client class for connecting to an Oauth instance.
- *
- * @package Joomla.Platform
- * @subpackage Oauth
- * @since 12.2
- */
-class JOauthHttp extends JHttp
-{
- /**
- * Method to send the PATCH command to the server.
- *
- * @param string $url Path to the resource.
- * @param mixed $data Either an associative array or a string to be sent with the request.
- * @param array $headers An array of name-value pairs to include in the header of the request.
- *
- * @return JHttpResponse
- *
- * @since 12.2
- */
- public function patch($url, $data, array $headers = null)
- {
- return $this->transport->request('PATCH', new JUri($url), $data, $headers);
- }
-}
View
12 libraries/joomla/oauth/v2client.php
@@ -40,16 +40,16 @@ class JOauthV2client
/**
* Constructor.
*
- * @param JRegistry $options JOauthV2client options object
- * @param JOauthHttp $http The HTTP client object
- * @param JInput $input The input object
+ * @param JRegistry $options JOauthV2client options object
+ * @param JHttp $http The HTTP client object
+ * @param JInput $input The input object
*
* @since 12.2
*/
- public function __construct(JRegistry $options = null, JOauthHttp $http = null, JInput $input = null)
+ public function __construct(JRegistry $options = null, JHttp $http = null, JInput $input = null)
{
$this->options = isset($options) ? $options : new JRegistry;
- $this->http = isset($http) ? $http : new JHttp($this->options, $this->client);
+ $this->http = isset($http) ? $http : new JHttp($this->options);
$this->input = isset($input) ? $input : JFactory::getApplication()->input;
}
@@ -114,7 +114,7 @@ public function isAuth()
if (!$token || !array_key_exists('access_token', $token))
{
return false;
- }
+ }
elseif (array_key_exists('expires_in', $token) && $token['created'] + $token['expires_in'] < time() + 20)
{
return false;
View
86 tests/suites/unit/joomla/oauth/JOauthHttpTest.php
@@ -1,86 +0,0 @@
-<?php
-/**
- * @package Joomla.UnitTest
- * @subpackage Client
- *
- * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE
- */
-
-require_once JPATH_PLATFORM . '/joomla/oauth/http.php';
-require_once JPATH_PLATFORM . '/joomla/http/transport/stream.php';
-
-/**
- * Test class for JOauth.
- *
- * @package Joomla.UnitTest
- * @subpackage Oauth
- * @since 12.2
- */
-class JOauthHttpTest extends PHPUnit_Framework_TestCase
-{
- /**
- * @var JRegistry Options for the Oauth object.
- * @since 12.2
- */
- protected $options;
-
- /**
- * @var JHttpTransportStream Mock client object.
- * @since 12.2
- */
- protected $transport;
-
- /**
- * @var JOauthHttp Object under test.
- * @since 12.2
- */
- protected $object;
-
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- * @return void
- */
- protected function setUp()
- {
- $this->options = new JRegistry;
- $this->transport = $this->getMock('JHttpTransportStream', array('request'), array($this->options), 'CustomTransport', false);
-
- $this->object = new JOauthHttp($this->options, $this->transport);
- }
-
- /**
- * Tears down the fixture, for example, closes a network connection.
- * This method is called after a test is executed.
- *
- * @access protected
- * @return void
- */
- protected function tearDown()
- {
- }
-
- /**
- * Tests the patch method
- *
- * @group JOauth
- * @return void
- */
- public function testPatch()
- {
- $uri = new JUri('https://example.com/gettest');
-
- $this->transport->expects($this->once())
- ->method('request')
- ->with('PATCH', $uri, array())
- ->will($this->returnValue('requestResponse'));
-
- $this->assertThat(
- $this->object->patch('https://example.com/gettest', array()),
- $this->equalTo('requestResponse')
- );
- }
-}
View
7 tests/suites/unit/joomla/oauth/JOauthV2clientTest.php
@@ -48,9 +48,16 @@ class JOauth2clientTest extends PHPUnit_Framework_TestCase
protected function setUp()
{
$this->options = new JRegistry;
+<<<<<<< HEAD
$this->http = $this->getMock('JOauthHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
$this->input = new JInput;
$this->object = new JOauth2client($this->options, $this->http, $this->input);
+=======
+ $this->http = $this->getMock('JHttp', array('head', 'get', 'delete', 'trace', 'post', 'put', 'patch'), array($this->options));
+ $array = array();
+ $this->input = new JInput($array);
+ $this->object = new JOauthV2client($this->options, $this->http, $this->input);
+>>>>>>> d006b01... Remove additional http class.
}
/**

0 comments on commit 870abf6

Please sign in to comment.