public function setUp()
{
$administratorRole = new Role('Neos.Flow:Administrator');
$this->administratorRole = $administratorRole;
$customerRole = new Role('Neos.Flow:Customer');
$this->customerRole = $customerRole;
$mockPolicyService = $this->createMock(PolicyService::class);
$mockPolicyService->expects($this->any())->method('getRole')->will($this->returnCallback(function ($roleIdentifier) use($administratorRole, $customerRole) {
switch ($roleIdentifier) {
case 'Neos.Flow:Administrator':
return $administratorRole;
case 'Neos.Flow:Customer':
return $customerRole;
default:
throw new NoSuchRoleException();
}
}));
$mockPolicyService->expects($this->any())->method('hasRole')->will($this->returnCallback(function ($roleIdentifier) use($administratorRole, $customerRole) {
switch ($roleIdentifier) {
case 'Neos.Flow:Administrator':
case 'Neos.Flow:Customer':
return true;
default:
return false;
}
}));
$this->account = $this->getAccessibleMock(Account::class, ['dummy']);
$this->account->_set('policyService', $mockPolicyService);
}