/** * @param array $data * @return ItemModel */ private function generateModel($data) { $itemModel = new ItemModel(); $itemModel->setUniqueId($data['uniqueId'])->setName($data['name'])->setAmount($data['amount'])->setQuantity($data['quantity'])->setCurrency($data['currency']); return $itemModel; }
public function testItemModel() { $staticData = ['uniqueId' => '1', 'name' => 'Baloon', 'amount' => '10.99', 'currency' => 'GBP', 'quantity' => '1']; $item = new ItemModel(); $item->setUniqueId($staticData['uniqueId']); $item->setName($staticData['name']); $item->setAmount($staticData['amount']); $item->setCurrency($staticData['currency']); $item->setQuantity($staticData['quantity']); $this->assertEquals($staticData['uniqueId'], $item->getUniqueId()); $this->assertEquals($staticData['name'], $item->getName()); $this->assertEquals($staticData['amount'], $item->getAmount()); $this->assertEquals($staticData['currency'], $item->getCurrency()); $this->assertEquals($staticData['quantity'], $item->getQuantity()); }