Exemplo n.º 1
0
 function testGetUser()
 {
     $path1 = "/" . self::TEST_ENCRYPTION_HELPER_USER1 . "/files/foo/bar.txt";
     $path2 = "/" . self::TEST_ENCRYPTION_HELPER_USER1 . "/cache/foo/bar.txt";
     $path3 = "/" . self::TEST_ENCRYPTION_HELPER_USER1 . "/thumbnails/foo";
     $path4 = "/" . "/" . self::TEST_ENCRYPTION_HELPER_USER1;
     // if we are logged-in every path should return the currently logged-in user
     $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, Encryption\Helper::getUser($path3));
     // now log out
     \Test_Encryption_Util::logoutHelper();
     // now we should only get the user from /user/files and user/cache paths
     $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, Encryption\Helper::getUser($path1));
     $this->assertEquals(self::TEST_ENCRYPTION_HELPER_USER1, Encryption\Helper::getUser($path2));
     $this->assertFalse(Encryption\Helper::getUser($path3));
     $this->assertFalse(Encryption\Helper::getUser($path4));
     // Log-in again
     \Test_Encryption_Util::loginHelper(\Test_Encryption_Helper::TEST_ENCRYPTION_HELPER_USER1);
 }