Example #1
0
 function testUpdate()
 {
     //Arrange
     $description = "Pliny the Elder";
     $cost = 5.0;
     $id = null;
     $test_item = new Item($description, $cost, $id);
     $test_item->save();
     $new_description = "Pliny the Younger";
     $new_cost = 10.0;
     //Act
     $test_item->update($new_description, $new_cost);
     //Assert
     $this->assertEquals($new_description, $test_item->getDescription());
     $this->assertEquals($new_cost, $test_item->getCost());
 }
 public function buy(Item $item)
 {
     $this->setArmor($this->getArmor() + $item->getArmor());
     $this->setDamage($this->getDamage() + $item->getDamage());
     $this->spentCash += $item->getCost();
 }