コード例 #1
0
 public function testWhenAccessoryNotFound()
 {
     $accessoryId = 1233;
     $this->accessoryRepository->expects($this->once())->method('LoadById')->with($this->equalTo($accessoryId))->will($this->returnValue(null));
     $this->service->GetAccessory($accessoryId);
     $this->assertEquals(RestResponse::NotFound(), $this->server->_LastResponse);
     $this->assertEquals(RestResponse::NOT_FOUND_CODE, $this->server->_LastResponseCode);
 }
コード例 #2
0
 public function testWhenDeleting()
 {
     $id = 1982;
     $this->page->expects($this->once())->method('GetAccessoryId')->will($this->returnValue($id));
     $this->accessoryRepository->expects($this->once())->method('Delete')->with($this->equalTo($id));
     $this->presenter->DeleteAccessory();
 }
コード例 #3
0
 public function testUnlimitedQuantity()
 {
     $accessory1 = new ReservationAccessory(1, 5);
     $quantityAvailable = null;
     $startDate = Date::Parse('2010-04-04', 'UTC');
     $endDate = Date::Parse('2010-04-05', 'UTC');
     $reservation = new TestReservationSeries();
     $reservation->WithAccessory($accessory1);
     $dr1 = new DateRange($startDate, $endDate);
     $reservation->WithDuration($dr1);
     $this->accessoryRepository->expects($this->at(0))->method('LoadById')->with($accessory1->AccessoryId)->will($this->returnValue(new Accessory($accessory1->AccessoryId, 'name1', $quantityAvailable)));
     $result = $this->rule->Validate($reservation);
     $this->assertTrue($result->IsValid());
 }