gnu-social/plugins/OStatus/tests/MagicEnvelopeTest.php
Bob Mottram 11c57e7aee Remove Google References
This removes most references to Google, with some
remaining since they may point to things which are still
relevant. References to Google Code, Google Buzz and
Google Maps have been removed
2016-03-20 13:06:58 +00:00

44 lines
1.2 KiB
PHP

<?php
if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
print "This script must be run from the command line\n";
exit();
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
define('GNUSOCIAL', true);
define('STATUSNET', true); // compatibility
require_once INSTALLDIR . '/lib/common.php';
class MagicEnvelopeTest extends PHPUnit_Framework_TestCase
{
/**
* Test that MagicEnvelope builds the correct plaintext for signing.
* @dataProvider provider
*/
public function testSignatureText(MagicEnvelope $env, $expected)
{
$text = $env->signingText();
$this->assertEquals($expected, $text, "'$text' should be '$expected'");
}
static public function provider()
{
// Sample case given in spec:
$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(
$magic_env,
'Tm90IHJlYWxseSBBdG9t.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng=='
)
);
}
}