public function testItems()
 {
     // backward compatibity test using \Omnipay\Common\Item
     $item = new OmnipayItem();
     $item->setName('Foo 1');
     $item->setDescription('Bar description.');
     $item->setPrice(5.0);
     $item->setQuantity(2);
     $bag = new ItemBag(array($item));
     $this->request->setItems($bag);
     $data = $this->request->getData();
     foreach ($bag->all() as $key => $value) {
         /** @var Item $value */
         $index = $key + 1;
         $this->assertSame($data["ITEMNAME{$index}"], $value->getName());
         $this->assertSame($data["ITEMDESC{$index}"], $value->getDescription());
         $this->assertSame($data["ITEMQUANT{$index}"], $value->getQuantity());
         $this->assertSame($data["ITEMPRICE{$index}"], $this->request->formatCurrency($value->getPrice()));
     }
 }
Esempio n. 2
0
 /**
  * @param string $value Max length of 16.
  * @return $this
  */
 public function setDescription($value)
 {
     return parent::setDescription(substr($value, 0, 16));
 }