public function testDoesNotMarkAsRequiringApprovalIfUserCanApproveForResource() { $series = new TestReservationSeries(); $resource = new FakeBookableResource(1); $resource->RequiresApproval(true); $series->WithResource($resource); $series->WithBookedBy($this->fakeUser); $this->authorizationService->expects($this->once())->method('CanApproveForResource')->with($this->equalTo($this->fakeUser), $this->equalTo($resource))->will($this->returnValue(true)); $this->rule->Validate($series); $this->assertFalse($series->RequiresApproval()); }
public function testCanSeeDetailsIfCanBeReserved() { $reservationView = new ReservationView(); $ownerId = 92929; $reservationView->OwnerId = $ownerId; $resource1 = new ReservationResourceView(1, '', 1, 1, 1); $reservationView->Resources = array($resource1); $this->authorizationService->expects($this->atLeastOnce())->method('CanReserveFor')->with($this->equalTo($this->currentUser), $this->equalTo($ownerId))->will($this->returnValue(false)); $this->authorizationService->expects($this->once())->method('CanEditForResource')->with($this->equalTo($this->currentUser), $this->equalTo($resource1))->will($this->returnValue(true)); $canSeeDetails = $this->reservationAuthorization->CanViewDetails($reservationView, $this->currentUser); $this->assertTrue($canSeeDetails); }