Skip to content

Commit

Permalink
Made getSignature private
Browse files Browse the repository at this point in the history
lasselehtinen committed Nov 21, 2017
1 parent 880ea11 commit f62139f
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Issuu.php
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ public function __construct($apiSecret, $apiKey, Client $client = null)
* @param array $queryParameters
* @return string
*/
public function getSignature($queryParameters)
private function getSignature($queryParameters)
{
// Sort request parameters alphabetically
ksort($queryParameters);
9 changes: 8 additions & 1 deletion tests/SignatureTest.php
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@

use lasselehtinen\Issuu\Issuu;
use PHPUnit\Framework\TestCase;
use ReflectionClass;

class SignatureTest extends TestCase
{
@@ -23,6 +24,12 @@ public function testSignatureCreation()
'format' => 'json',
];

$this->assertSame('7431d31140cf412ab5caa73586d6324a', $issuu->getSignature($parameters));
// Create new ReflectionClass to test private method
$reflection = new ReflectionClass(get_class($issuu));
$method = $reflection->getMethod('getSignature');
$method->setAccessible(true);
$signature = $method->invokeArgs($issuu, [$parameters]);

$this->assertSame('7431d31140cf412ab5caa73586d6324a', $signature);
}
}

0 comments on commit f62139f

Please sign in to comment.