소스 검색

test login & logout

Fabian Peter Hammerle 8 년 전
부모
커밋
676f8c82de
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      tests/ArrayHelperTest.php

+ 11 - 0
tests/ArrayHelperTest.php

@@ -42,4 +42,15 @@ class ClientCertAuthTest extends \PHPUnit_Framework_TestCase
         $this->assertContains(['id' => 1, 'username' => 'a'], $users);
         $this->assertContains(['id' => 2, 'username' => 'b'], $users);
     }
+
+    public function testLoginLogout()
+    {
+        $app = $this->mockApplication();
+        $alice = new models\User('alice');
+        $alice->save();
+        $this->assertTrue($app->user->login($alice));
+        $this->assertSame($alice, $app->user->identity);
+        $app->user->logout();
+        $this->assertNull($app->user->identity);
+    }
 }