/**
* @test
*/
public function editorUpdatesOnlyDesiredValueInWpConfig()
{
file_put_contents($this->commonConfigPath, '<?php
// ** MySQL settings ** //
/** The name of the database for WordPress */
define(\'DB_NAME\', \'vp01\');
$table_prefix = \'wp_\';
$my_variable = \'value\';
$test = \'value\';
/* That\'s all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined(\'ABSPATH\') )
define(\'ABSPATH\', dirname(__FILE__) . \'/\');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . \'wp-settings.php\');
');
$a = new WpConfigEditor($this->commonConfigPath, false);
$a->updateConfigVariable('my_variable', 'another value');
$expectedContent = '<?php
// ** MySQL settings ** //
/** The name of the database for WordPress */
define(\'DB_NAME\', \'vp01\');
$table_prefix = \'wp_\';
$my_variable = \'another value\';
$test = \'value\';
/* That\'s all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined(\'ABSPATH\') )
define(\'ABSPATH\', dirname(__FILE__) . \'/\');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . \'wp-settings.php\');
';
$this->assertEquals($expectedContent, file_get_contents($this->commonConfigPath));
}