/** * @dataProvider hasProvider * * @covers ::has * @covers ::set * * @param array $contents An array of items to store, indexed by id * @param string $id The id to pass to ::has * @param boolean $expected The expected result of ::has($id) */ public function testHas(array $contents, $id, $expected) { $container = new Container(); foreach ($contents as $itemId => $item) { $container->set($itemId, $item); } $this->assertEquals($expected, $container->has($id)); }
/** * {@inheritdoc} */ public function has($id) { $getter = $this->getGetter($id); if (parent::has($id) || \method_exists($this, $getter)) { return true; } return false; }