Exemplo n.º 1
0
	public function testSetValues() {
		$content = file_get_contents($this->configFile);
		$this->assertEquals(self::TESTCONTENT, $content);

		// Changing configs to existing values and deleting non-existing once
		// should not rewrite the config.php
		$this->config->setValues([
			'foo'			=> 'bar',
			'not_exists'	=> null,
		]);

		$this->assertAttributeEquals($this->initialConfig, 'cache', $this->config);
		$content = file_get_contents($this->configFile);
		$this->assertEquals(self::TESTCONTENT, $content);

		$this->config->setValues([
			'foo'			=> 'moo',
			'alcohol_free'	=> null,
		]);
		$expectedConfig = $this->initialConfig;
		$expectedConfig['foo'] = 'moo';
		unset($expectedConfig['alcohol_free']);
		$this->assertAttributeEquals($expectedConfig, 'cache', $this->config);

		$content = file_get_contents($this->configFile);
		$expected = "<?php\n\$CONFIG = array (\n  'foo' => 'moo',\n  'beers' => \n  array (\n    0 => 'Appenzeller',\n  " .
			"  1 => 'Guinness',\n    2 => 'Kölsch',\n  ),\n);\n";
		$this->assertEquals($expected, $content);
	}
Exemplo n.º 2
0
 /**
  * Sets and deletes values and writes the config.php
  *
  * @param array $configs Associative array with `key => value` pairs
  *                       If value is null, the config key will be deleted
  */
 public function setValues(array $configs)
 {
     $this->config->setValues($configs);
 }
Exemplo n.º 3
0
 /**
  * Sets and deletes values and writes the config.php
  *
  * @param array $configs Associative array with `key => value` pairs
  *                       If value is null, the config key will be deleted
  */
 public static function setValues(array $configs)
 {
     self::$object->setValues($configs);
 }