コード例 #1
0
 public function testFiltersResourcesWhenGettingResourceGroups()
 {
     $scheduleId = 18;
     $expectedGroups = new FakeResourceGroupTree();
     $expectedGroups->AddGroup(new ResourceGroup(1, 'g'));
     $this->resourceRepository->expects($this->once())->method('GetResourceGroups')->with($this->equalTo($scheduleId), $this->anything())->will($this->returnValue($expectedGroups));
     $groups = $this->resourceService->GetResourceGroups($scheduleId, $this->fakeUser);
     $this->assertEquals($expectedGroups, $groups);
 }
コード例 #2
0
 public function testRedirectsIfUserHasPermissionToZeroResources()
 {
     $requestedScheduleId = 10;
     $requestedResourceId = null;
     $this->initializer->expects($this->once())->method('GetScheduleId')->will($this->returnValue($requestedScheduleId));
     $this->initializer->expects($this->once())->method('GetResourceId')->will($this->returnValue($requestedResourceId));
     $this->initializer->expects($this->once())->method('CurrentUser')->will($this->returnValue($this->fakeUser));
     $resourceList = array();
     $groups = new FakeResourceGroupTree();
     $groups->WithAllResources($resourceList);
     $this->resourceService->expects($this->once())->method('GetResourceGroups')->with($this->equalTo($requestedScheduleId), $this->equalTo($this->fakeUser))->will($this->returnValue($groups));
     $this->initializer->expects($this->once())->method('RedirectToError')->with($this->equalTo(ErrorMessages::INSUFFICIENT_PERMISSIONS));
     $binder = new ReservationResourceBinder($this->resourceService);
     $binder->Bind($this->initializer);
 }