public function testSetFleetId() { $fleetResource = new FleetResource(); $fleetResource->setFleetId(1); $this->assertEquals(1, $fleetResource->getFleetId()); $fleetResource->setFleetId(99); $this->assertEquals(99, $fleetResource->getFleetId()); $this->setExpectedException('Core\\Entity\\Exception'); $fleetResource->setFleetId('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; }