/** * Test composition from mix of arrays and adapter instances */ public function testNamedComposition() { $repository = new ConfigRepository([new PhpConstantsAdapter(__DIR__ . '/Resources/config.simple.php'), 'second' => new PhpConstantsAdapter(__DIR__ . '/Resources/config.simple.php')], new DotEnvAdapter(__DIR__ . '/Resources', '.env')); $this->assertInstanceOf(PhpConstantsAdapter::class, $repository->getAdapter(PhpConstantsAdapter::class)); $this->assertInstanceOf(PhpConstantsAdapter::class, $repository->getAdapter('second')); $this->assertInstanceOf(DotEnvAdapter::class, $repository->getAdapter(DotEnvAdapter::class)); }
/** * @expectedException \ActiveCollab\ConfigRepository\Exception\LogicException */ public function testSet() { $this->repository->set('FIRST', 12); }
/** * @expectedException \ActiveCollab\ConfigRepository\Exception\OptionNotFound */ public function testMustGetNotFoundException() { $this->repository->mustGet('NOT FOUND FOR SURE'); }
/** * Test if option exists if an adapter */ public function testExists() { $this->assertTrue($this->repository->exists('FIRST')); $this->assertFalse($this->repository->exists('NOT FOUND')); }
/** * Test set value */ public function testSet() { $this->repository->set('FIRST', 12); $this->assertEquals(12, $this->repository->get('FIRST')); }