Esempio n. 1
0
 public function testReturnDefaultIfNotSet()
 {
     $default = new Config();
     $default->set(Config::PULI_DIR, 'default');
     $config = new EnvConfig($default);
     $this->assertSame('default', $config->get(Config::PULI_DIR));
 }
 public function testFindConfigKeysReturnsParsedValuesIfEnabled()
 {
     $this->baseConfig->set(Config::FACTORY_AUTO_GENERATE, true);
     $this->configFile->getConfig()->set(Config::PULI_DIR, 'my-puli-dir');
     $this->configFile->getConfig()->set(Config::FACTORY_IN_CLASS, 'MyFactory');
     $this->configFile->getConfig()->set(Config::FACTORY_IN_FILE, '{$puli-dir}/MyFactory.php');
     $this->assertSame(array(Config::FACTORY_IN_CLASS => 'MyFactory', Config::FACTORY_IN_FILE => 'my-puli-dir/MyFactory.php'), $this->manager->findConfigKeys(Expr::startsWith('factory.'), false, false, false));
 }
 public function testWriteRootPackageFileDoesNotWriteBaseConfigValues()
 {
     $baseConfig = new Config();
     $baseConfig->set(Config::PULI_DIR, 'puli-dir');
     $packageFile = new RootPackageFile(null, null, $baseConfig);
     $this->writer->writePackageFile($packageFile, $this->tempFile);
     $this->assertFileExists($this->tempFile);
     $this->assertJsonFileEquals(__DIR__ . '/Fixtures/json/minimal.json', $this->tempFile);
 }
Esempio n. 4
0
 public function testIsEmptyWithoutFallback()
 {
     $baseConfig = new Config();
     $config = new Config($baseConfig);
     $this->assertTrue($config->isEmpty(false));
     $baseConfig->set(Config::PULI_DIR, 'my-puli-dir');
     $this->assertTrue($config->isEmpty(false));
     $config->set(Config::PULI_DIR, 'my-puli-dir');
     $this->assertFalse($config->isEmpty(false));
 }
 public function testRootPackageFileInheritsBaseConfig()
 {
     $packageFile = $this->serializer->unserializeRootPackageFile(self::MINIMAL_JSON, null, $this->baseConfig);
     $this->baseConfig->set(Config::PULI_DIR, 'my-puli-dir');
     $this->assertSame('my-puli-dir', $packageFile->getConfig()->get(Config::PULI_DIR));
 }
 public function testRootPackageFileInheritsBaseConfig()
 {
     $packageFile = $this->reader->readRootPackageFile(__DIR__ . '/Fixtures/json/minimal.json', $this->baseConfig);
     $this->baseConfig->set(Config::PULI_DIR, 'my-puli-dir');
     $this->assertSame('my-puli-dir', $packageFile->getConfig()->get(Config::PULI_DIR));
 }