public function testRootUser() { $em = \Phake::mock('Doctrine\\ORM\\EntityManager'); $rootUserHandler = \Phake::mock('Modera\\SecurityBundle\\RootUserHandling\\RootUserHandlerInterface'); $service = new UserService($em, $rootUserHandler); $user = \Phake::mock(User::clazz()); \Phake::when($rootUserHandler)->getUser()->thenReturn($user); \Phake::when($rootUserHandler)->isRootUser($user)->thenReturn(true); $this->assertEquals($user, $service->getRootUser()); $this->assertTrue($service->isRootUser($user)); }