public function AddAccessory() { $name = $this->page->GetAccessoryName(); $quantity = $this->page->GetQuantityAvailable(); Log::Debug('Adding new accessory with name %s and quantity %s', $name, $quantity); $this->accessoryRepository->Add(Accessory::Create($name, $quantity)); }
public function testCanAdd() { $name = 'n'; $available = 100; $accessory = Accessory::Create($name, $available); $command = new AddAccessoryCommand($name, $available); $this->repository->Add($accessory); $this->assertEquals($command, $this->db->_LastCommand); }
public function testWhenAdding() { $name = 'accessory'; $quantity = 2; $expectedAccessory = Accessory::Create($name, $quantity); $this->page->expects($this->once())->method('GetAccessoryName')->will($this->returnValue($name)); $this->page->expects($this->once())->method('GetQuantityAvailable')->will($this->returnValue($quantity)); $this->accessoryRepository->expects($this->once())->method('Add')->with($this->equalTo($expectedAccessory)); $this->presenter->AddAccessory(); }
public function run() { // Initialize empty array $accessory = array(); $date = new DateTime(); $accessory[] = array('name' => 'Cisco Desktop Phone', 'category_id' => 4, 'qty' => '20', 'requestable' => '0', 'user_id' => 1); $accessory[] = array('name' => 'ASUS 23-inch', 'category_id' => 5, 'qty' => '20', 'requestable' => '0', 'user_id' => 1); // Delete all the old data DB::table('accessories')->truncate(); // Insert the new posts Accessory::insert($accessory); }
public function __construct(IRestServer $server, Accessory $accessory) { $this->id = $accessory->GetId(); $this->name = $accessory->GetName(); $this->quantityAvailable = $accessory->GetQuantityAvailable(); }
/** * @param Accessory $accessory * @return void */ public function Update(Accessory $accessory) { ServiceLocator::GetDatabase()->Execute(new UpdateAccessoryCommand($accessory->GetId(), $accessory->GetName(), $accessory->GetQuantityAvailable())); }
/** * @return int */ public function QuantityAvailable() { return $this->accessory->GetQuantityAvailable(); }