forked from GNUsocial/gnu-social
MagicEnvelope object orientation (no passing arrays)
MagicEnvelope now uses object properties instead of passing arrays around everywhere.
This commit is contained in:
@@ -17,26 +17,26 @@ class MagicEnvelopeTest extends PHPUnit_Framework_TestCase
|
||||
* Test that MagicEnvelope builds the correct plaintext for signing.
|
||||
* @dataProvider provider
|
||||
*/
|
||||
public function testSignatureText($env, $expected)
|
||||
public function testSignatureText(MagicEnvelope $env, $expected)
|
||||
{
|
||||
$magic = new MagicEnvelope;
|
||||
$text = $magic->signingText($env);
|
||||
$text = $env->signingText();
|
||||
|
||||
$this->assertEquals($expected, $text, "'$text' should be '$expected'");
|
||||
}
|
||||
|
||||
static public function provider()
|
||||
{
|
||||
// Sample case given in spec:
|
||||
// http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-magicsig-00.html#signing
|
||||
$magic_env = new MagicEnvelope();
|
||||
$magic_env->data = 'Tm90IHJlYWxseSBBdG9t';
|
||||
$magic_env->data_type = 'application/atom+xml';
|
||||
$magic_env->encoding = 'base64url';
|
||||
$magic_env->alg = 'RSA-SHA256';
|
||||
|
||||
return array(
|
||||
array(
|
||||
// Sample case given in spec:
|
||||
// http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-magicsig-00.html#signing
|
||||
array(
|
||||
'data' => 'Tm90IHJlYWxseSBBdG9t',
|
||||
'data_type' => 'application/atom+xml',
|
||||
'encoding' => 'base64url',
|
||||
'alg' => 'RSA-SHA256'
|
||||
),
|
||||
$magic_env,
|
||||
'Tm90IHJlYWxseSBBdG9t.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng=='
|
||||
)
|
||||
);
|
||||
|
Reference in New Issue
Block a user