/** * @return \Gumer\PSN\Authentication\UserInterface * @throws \RuntimeException */ public function user() { if (!$this->user) { if (!($user = $this->manager->user())) { throw new RuntimeException('The request object requires a valid user instance for the request to be authenticated.'); } $this->user = $user; } return $this->user; }
public function testAssigningUser() { $userProvider = m::mock('Gumer\\PSN\\Authentication\\UserProviderInterface'); $userInstance = m::mock('Gumer\\PSN\\Authentication\\UserInterface'); $manager = Manager::instance($userProvider); $manager->be($userInstance); $this->assertSame($userInstance, $manager->user()); }