public function getData($name) { if ($this->isStarted()) { return $this->storage->getData($this->id, $name); } return null; }
/** * @covers Cart\SessionStorage::getData * @todo Implement testGetData(). */ public function testGetData() { $result = (bool) $this->object->getData(); $this->assertFalse($result); $result = (bool) $this->object->getData('SProducts', 82); $this->assertFalse($result); $result = (bool) $this->object->getData('ShopKit', 16); $this->assertFalse($result); $result = (bool) $this->object->getData(1, 82); $this->assertFalse($result); $result = (bool) $this->object->getData(2, 16); $this->assertFalse($result); /** Sproduct array * */ $data["SProducts_71_82"] = array('instance' => 'SProducts', 'id' => 82, 'quantity' => 5); /** Save to storage * */ $this->object->setData($data); $result = (bool) $this->object->getData('SProducts', 82); $this->assertTrue($result); $result = (bool) $this->object->getData(1, 82); $this->assertTrue($result); /** ShopKit array * */ $data['ShopKit_16'] = array('instance' => 'ShopKit', 'id' => 16, 'quantity' => 5); /** Save to storage * */ $this->object->setData($data); $result = (bool) $this->object->getData('ShopKit', 16); $this->assertTrue($result); $result = (bool) $this->object->getData(2, 16); $this->assertTrue($result); }