/** * @see WpTestsStarter::createDummyConfigFile() */ public function testCreateDummyConfigFile() { $baseDir = dirname(__DIR__) . '/tmp'; $configFile = $baseDir . '/wp-tests-config.php'; $testee = new WpTestsStarter($baseDir); $const = strtoupper(__FUNCTION__); $testee->defineConst($const, 'FOO'); $testee->defineConst($const . '_1', 'FOO'); $testee->defineConst($const . '_2', 'FOO'); if (file_exists($configFile)) { unlink($configFile); } $this->assertFileNotExists($configFile, "Remove the temporary config file before running this test."); $testee->createDummyConfigFile(); $this->assertFileExists($configFile); $fileContent = file_get_contents($configFile); # count the number of definitions in the file $replaceCount = 0; str_replace('define(', 'define(', $fileContent, $replaceCount); $this->assertEquals(3, $replaceCount); unlink($configFile); }