public function getEntry($name) { if (!isset($this->list[$name])) { throw new E4xx_NoSuchConfigEntry($name); } return $this->list[$name]; }
/** * @covers DataSift\Storyplayer\ConfigLib\ConfigList::__construct * @covers DataSift\Storyplayer\ConfigLib\ConfigList::addHardCodedList */ public function testCanAddEntriesFromAHardCodedList() { // ---------------------------------------------------------------- // setup your test $obj = new ConfigList("DataSift\\Storyplayer\\ConfigLib\\WrappedConfig", __DIR__ . '/ConfigListTestData1'); $hardCodedList = new HardCodedList('DataSift\\Storyplayer\\ConfigLib\\WrappedConfig'); $expected1 = $hardCodedList->newConfig('hard-coded-config-1'); $expected1->getConfig()->name = 'config-1'; $expected2 = $hardCodedList->newConfig('hard-coded-config-2'); $expected2->getConfig()->name = 'config-2'; // ---------------------------------------------------------------- // perform the change $obj->addHardCodedList($hardCodedList); // ---------------------------------------------------------------- // test the results $this->assertTrue($obj->hasEntry('hard-coded-config-1')); $this->assertSame($expected1, $obj->getEntry('hard-coded-config-1')); $this->assertTrue($obj->hasEntry('hard-coded-config-2')); $this->assertSame($expected2, $obj->getEntry('hard-coded-config-2')); }