public function testSetAmount() { $fleetResource = new FleetResource(); $fleetResource->setAmount(1); $this->assertEquals(1, $fleetResource->getAmount()); $fleetResource->setAmount(99); $this->assertEquals(99, $fleetResource->getAmount()); $this->setExpectedException('Core\\Entity\\Exception'); $fleetResource->setAmount('a'); }
/** * Get one specific resource from a fleet specified by given compound primary key. * One resource from a fleet - not more! * ATTENTION: This function allways return a fleetresource object even if the * tech is not in the fleet! * * @param array $key The compound primary key in form: array('fleet_id' => 1, 'resource_id' => 2) * @return boolean $forceResultEntity * @return \Fleet\Entity\FleetResource | array */ public function getFleetResource(array $key, $forceResultEntity = false) { $result = $this->getTable('fleetresource')->select($key)->current(); if (empty($result) && $forceResultEntity) { $result = new FleetResource(); $result->setFleetId($key['fleet_id']); $result->setResourceId($key['resource_id']); $result->setAmount(0); } return $result; }