This repository has been archived by the owner on Nov 26, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slight changes to the constructors of JGoogle.
Added unit test: JGoogleAuthOauth2Test.php
- Loading branch information
1 parent
7a0e1e7
commit 7d0a513
Showing
4 changed files
with
129 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
/** | ||
* @package Joomla.UnitTest | ||
* | ||
* @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/google/google.php'; | ||
|
||
/** | ||
* Test class for JGoogle. | ||
*/ | ||
class JGoogleAuthOauth2Test extends PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var JRegistry Options for the JOauth2client object. | ||
*/ | ||
protected $options; | ||
|
||
/** | ||
* @var JHttp Mock client object. | ||
*/ | ||
protected $client; | ||
|
||
/** | ||
* @var JInput The input object to use in retrieving GET/POST data. | ||
*/ | ||
protected $input; | ||
|
||
/** | ||
* @var JOauth2client The OAuth client for sending requests to Google. | ||
*/ | ||
protected $oauth; | ||
|
||
/** | ||
* @var JGoogleAuthOauth2 Object under test. | ||
*/ | ||
protected $object; | ||
|
||
/** | ||
* Sets up the fixture, for example, opens a network connection. | ||
* This method is called before a test is executed. | ||
* | ||
* @access protected | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->options = new JRegistry; | ||
$this->client = $this->getMock('JHttp', array('post')); | ||
$this->input = new JInput; | ||
$this->oauth = new JOauth2client($this->options, $this->client, $this->input); | ||
$this->object = new JGoogleAuthOauth2($this->options, $this->oauth); | ||
} | ||
|
||
/** | ||
* Tears down the fixture, for example, closes a network connection. | ||
* This method is called after a test is executed. | ||
* | ||
* @access protected | ||
*/ | ||
protected function tearDown() | ||
{ | ||
} | ||
|
||
/** | ||
* Tests the setOption method | ||
* @group JGoogle | ||
* @return void | ||
*/ | ||
public function testSetOption() | ||
{ | ||
$this->object->setOption('key', 'value'); | ||
|
||
$this->assertThat( | ||
$this->options->get('key'), | ||
$this->equalTo('value') | ||
); | ||
} | ||
|
||
/** | ||
* Tests the getOption method | ||
* @group JGoogle | ||
* @return void | ||
*/ | ||
public function testStuff() | ||
{ | ||
$this->options->set('key', 'value'); | ||
|
||
$this->assertThat( | ||
$this->object->getOption('key'), | ||
$this->equalTo('value') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters