public function testGenerate() { $generatedDir = $this->getFixturesDir('temporary/generated'); $this->assertFileNotExists($generatedDir); File::makeDirectory($generatedDir, 0777, true, true); $this->assertFileExists($generatedDir); $structure = ['author', 'author/plugin', 'author/plugin/plugin.php' => 'plugin.php.tpl', 'author/plugin/classes']; $templatesDir = $this->getFixturesDir('templates'); $generator = new FilesystemGenerator($generatedDir, $structure, $templatesDir); $variables = ['authorNamespace' => 'Author', 'pluginNamespace' => 'Plugin']; $generator->setVariables($variables); $generator->setVariable('className', 'TestClass'); $generator->generate(); $this->assertFileExists($generatedDir . '/author/plugin/plugin.php'); $this->assertFileExists($generatedDir . '/author/plugin/classes'); $content = file_get_contents($generatedDir . '/author/plugin/plugin.php'); $this->assertContains('Author\\Plugin', $content); $this->assertContains('TestClass', $content); }