/** * Test for SettingsContainer get. */ public function testGet() { $pool = new Pool(); $settingsContainer = new SettingsContainer($pool); $provider = new ManagerAwareSettingProvider(); $provider->setManager($this->getManager()); $settingsContainer->addProvider($provider); // First time, it should be loaded from database. $settings = $settingsContainer->get('test'); $this->assertEquals('test1', $settings); // Second time it should be loaded from object itself. $this->getManager()->getConnection()->dropIndex(); $settings = $settingsContainer->get('test'); $this->assertEquals('test1', $settings); $settings = $settingsContainer->get('test2'); $this->assertEquals('test2', $settings); }
/** * Test if exception is being thrown. * * @expectedException \InvalidArgumentException */ public function testException() { $poolMock = $this->getPool(false); $container = new SettingsContainer($poolMock); $container->get('whatever'); }