Use Interfaces anywhere.
In practice, there were still too many concrete classes, which makes integration into a framework hard. To overcome this, the codebase has been refactored to use Interfaces when a resource is needed. All necessary Interfaces have been created, and the existing concrete classes now implement these interfaces.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Mockery as m;
|
||||
use JacobKiers\OAuth\PlainText;
|
||||
use JacobKiers\OAuth\SignatureMethod\PlainText;
|
||||
|
||||
class PlainTextTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -23,7 +23,7 @@ public function testBuildSignatureWithoutToken()
|
||||
|
||||
// Get mock objects
|
||||
$request = $this->getRequest();
|
||||
$client = $this->getClient();
|
||||
$client = $this->getConsumer();
|
||||
|
||||
// Run method being tested
|
||||
$signature = $plaintext->buildSignature($request, $client);
|
||||
@@ -39,7 +39,7 @@ public function testBuildSignatureWithToken()
|
||||
|
||||
// Get mock objects
|
||||
$request = $this->getRequest();
|
||||
$client = $this->getClient();
|
||||
$client = $this->getConsumer();
|
||||
$token = $this->getToken();
|
||||
|
||||
// Run method being tested
|
||||
@@ -56,19 +56,19 @@ private function getSignatureMethod()
|
||||
|
||||
private function getRequest()
|
||||
{
|
||||
return m::mock('JacobKiers\OAuth\Request');
|
||||
return m::mock('JacobKiers\OAuth\Request\Request');
|
||||
}
|
||||
|
||||
private function getClient()
|
||||
private function getConsumer()
|
||||
{
|
||||
return m::mock('JacobKiers\OAuth\Client', function ($mock) {
|
||||
return m::mock('JacobKiers\OAuth\Consumer\Consumer', function ($mock) {
|
||||
$mock->shouldReceive('getSecret')->withNoArgs()->andReturn('secret')->once();
|
||||
});
|
||||
}
|
||||
|
||||
private function getToken()
|
||||
{
|
||||
return m::mock('JacobKiers\OAuth\Token', function ($mock) {
|
||||
return m::mock('JacobKiers\OAuth\Token\Token', function ($mock) {
|
||||
$mock->shouldReceive('getSecret')->withNoArgs()->andReturn('token_secret');
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user