/** * Tests BasicBlobCrypter->wrap() exception */ public function testWrapException() { $this->setExpectedException('BlobExpiredException'); $test = array(); $test['o'] = 'o'; $test['v'] = 'v'; $test['a'] = 'a'; $test['d'] = 'd'; $test['u'] = 'u'; $test['m'] = 'm'; $wrapped = $this->BasicBlobCrypter->wrap($test); /* there is a 180 seconds clock skew allowed, so this way we make sure it's expired */ $this->BasicBlobCrypter->unwrap($wrapped, -4000); }
/** * Tests BasicBlobCrypter->unwrap() with plaintext token */ public function testUnwrapPlaintextToken() { $token = "o:v:a:d:http://host:80/gadget.xml:m:c"; $unwrapped = $this->BasicBlobCrypter->unwrap($token, null); $this->assertEquals($unwrapped['o'], 'o'); $this->assertEquals($unwrapped['v'], 'v'); $this->assertEquals($unwrapped['a'], 'a'); $this->assertEquals($unwrapped['d'], 'd'); $this->assertEquals($unwrapped['u'], 'http://host:80/gadget.xml'); $this->assertEquals($unwrapped['m'], 'm'); }