Exemplo n.º 1
0
 public function testAddsNewQuota()
 {
     $duration = QuotaDuration::Month;
     $limit = 2.4;
     $unit = QuotaUnit::Reservations;
     $resourceId = 2183;
     $groupId = 123987;
     $scheduleId = 102983;
     $quota = Quota::Create($duration, $limit, $unit, $resourceId, $groupId, $scheduleId);
     $command = new AddQuotaCommand($duration, $limit, $unit, $resourceId, $groupId, $scheduleId);
     $this->repository->Add($quota);
     $this->assertEquals($command, $this->db->_LastCommand);
 }
Exemplo n.º 2
0
 public function AddQuota()
 {
     Log::Debug('Adding new quota. Duration %s, Limit %s, Unit %s, Resource %s, Group %s, Schedule %s', $this->page->GetDuration(), $this->page->GetLimit(), $this->page->GetUnit(), $this->page->GetResourceId(), $this->page->GetGroupId(), $this->page->GetScheduleId());
     $quota = Quota::Create($this->page->GetDuration(), $this->page->GetLimit(), $this->page->GetUnit(), $this->page->GetResourceId(), $this->page->GetGroupId(), $this->page->GetScheduleId());
     $this->quotaRepository->Add($quota);
 }
 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();
 }