public function testGettingAccessibleGroupsWhithErroredUser() { $this->context->expects($this->exactly(3))->method('isGranted')->will($this->returnValue(false)); $this->groupRepo->expects($this->never())->method('getChildren'); $this->user->expects($this->once())->method('getGroup')->will($this->returnValue(null)); $this->setExpectedException('\\RuntimeException', 'Security error! This user should not have empty group access. This can lead to security breach.'); $this->assertEmpty($this->resolver->getAccessibleGroups()); }