public function testWhenAdding() { $duration = QuotaDuration::Day; $limit = 2; $unit = QuotaUnit::Hours; $resourceId = 987; $groupId = 8287; $scheduleId = 400; $this->page->expects($this->atLeastOnce())->method('GetDuration')->will($this->returnValue($duration)); $this->page->expects($this->atLeastOnce())->method('GetLimit')->will($this->returnValue($limit)); $this->page->expects($this->atLeastOnce())->method('GetUnit')->will($this->returnValue($unit)); $this->page->expects($this->atLeastOnce())->method('GetResourceId')->will($this->returnValue($resourceId)); $this->page->expects($this->atLeastOnce())->method('GetGroupId')->will($this->returnValue($groupId)); $this->page->expects($this->atLeastOnce())->method('GetScheduleId')->will($this->returnValue($scheduleId)); $expectedQuota = Quota::Create($duration, $limit, $unit, $resourceId, $groupId, $scheduleId); $this->quotaRepository->expects($this->once())->method('Add')->with($this->equalTo($expectedQuota)); $this->presenter->AddQuota(); }
public function DeleteQuota() { $quotaId = $this->page->GetQuotaId(); Log::Debug('Deleting quota %s', $quotaId); $this->quotaRepository->DeleteById($quotaId); }