3 if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
4 print "This script must be run from the command line\n";
8 define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
9 define('GNUSOCIAL', true);
10 define('STATUSNET', true); // compatibility
12 require_once INSTALLDIR . '/lib/common.php';
14 class MagicEnvelopeTest extends PHPUnit_Framework_TestCase
17 * Test that MagicEnvelope builds the correct plaintext for signing.
18 * @dataProvider provider
20 public function testSignatureText(MagicEnvelope $env, $expected)
22 $text = $env->signingText();
24 $this->assertEquals($expected, $text, "'$text' should be '$expected'");
27 static public function provider()
29 // Sample case given in spec:
30 // http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-magicsig-00.html#signing
31 $magic_env = new MagicEnvelope();
32 $magic_env->data = 'Tm90IHJlYWxseSBBdG9t';
33 $magic_env->data_type = 'application/atom+xml';
34 $magic_env->encoding = 'base64url';
35 $magic_env->alg = 'RSA-SHA256';
40 'Tm90IHJlYWxseSBBdG9t.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng=='