Permalink
Browse files

test auth expire session destroys session

  • Loading branch information...
1 parent 306f878 commit 2c817990968e1fcd878d132a7402ea7500ebf008 @daaku daaku committed Jul 17, 2012
Showing with 26 additions and 0 deletions.
  1. +26 −0 tests/tests.php
View
26 tests/tests.php
@@ -1280,6 +1280,32 @@ public function testDestroyClearsCookie() {
array_key_exists($fb->publicGetSignedRequestCookieName(), $_COOKIE));
}
+ public function testAuthExpireSessionDestroysSession() {
+ $methods_to_stub = array(
+ '_oauthRequest',
+ 'destroySession',
+ );
+ $constructor_args = array(array(
+ 'appId' => self::APP_ID,
+ 'secret' => self::SECRET
+ ));
+ $key = 'foo';
+ $val = 42;
+ $stub = $this->getMock(
+ 'TransientFacebook', $methods_to_stub, $constructor_args);
+ $stub
+ ->expects($this->once())
+ ->method('_oauthRequest')
+ ->will($this->returnValue("{\"$key\":$val}"));
+ $stub
+ ->expects($this->once())
+ ->method('destroySession');
+ $this->assertEquals(
+ array($key => $val),
+ $stub->api(array('method' => 'auth.expireSession'))
+ );
+ }
+
protected function generateMD5HashOfRandomValue() {
return md5(uniqid(mt_rand(), true));
}

0 comments on commit 2c81799

Please sign in to comment.