/** * @covers CodeCollab\Authentication\User::__construct * @covers CodeCollab\Authentication\User::rehash */ public function testRehash() { $user = new User($this->createMock(Session::class)); $this->assertRegExp('/^\\$2y\\$14\\$(.*)$/', $user->rehash('password')); $this->assertSame(60, strlen($user->rehash('password'))); }
/** * Setup decryptor */ $decryptor = new Decryptor(file_get_contents(__DIR__ . '/encryption.key')); /** * Setup the request object */ $request = new Request($decryptor, $_SERVER, $_GET, $_POST, $_FILES, $_COOKIE, file_get_contents('php://input')); /** * Setup the session */ $session = new Session('/', $request->server('SERVER_NAME'), $request->isEncrypted()); /** * Setup authentication object */ $user = new User($session); /** * Setup the router */ $routeCache = $user->isLoggedIn() ? '/cache/routes-authenticated.php' : '/cache/routes.php'; $routeCollector = new RouteCollector(new RouteParser(), new RouteDataGenerator()); $router = new Router($routeCollector, function ($dispatchData) { return new RouteDispatcher($dispatchData); }, __DIR__ . $routeCache, !$production); /** * Load routes */ require_once __DIR__ . '/routes.php'; /** * Setup the theme */