5 use Omnipay\Tests\TestCase;
16 $bag =
new ItemBag(array(array(
'name' =>
'Floppy Disk')));
17 $this->assertCount(1, $bag);
25 $this->assertSame($items, $bag->all());
31 $this->bag->replace($items);
33 $this->assertSame($items, $this->bag->all());
40 $this->bag->add($item);
42 $contents = $this->bag->all();
43 $this->assertSame($item, $contents[0]);
48 $item = array(
'name' =>
'CD-ROM');
49 $this->bag->add($item);
51 $contents = $this->bag->all();
52 $this->assertInstanceOf(
'\Omnipay\Common\Item', $contents[0]);
53 $this->assertSame(
'CD-ROM', $contents[0]->getName());
60 $this->bag->add($item);
62 foreach ($this->bag as $bagItem) {
63 $this->assertSame($item, $bagItem);
69 $this->bag->add(
new Item);
70 $this->bag->add(
new Item);
71 $this->bag->add(
new Item);
73 $this->assertSame(3, count($this->bag));