public function testRunonceCreateFiredBeforeRunonceExecuted() { RunonceManager::clearRunonces(); $array = var_export(array('composer/vendor/unit/test/runonce1.php'), true); $testData = <<<EOF <?php \$executor = new \\ContaoCommunityAlliance\\Composer\\Plugin\\RunonceExecutor(); \$executor->run({$array}); EOF; file_put_contents($this->rootDir . '/system/runonce.php', $testData); RunonceManager::addRunonce('composer/vendor/unit/test/runonce1.php'); RunonceManager::addRunonce('composer/vendor/unit/test/runonce2.php'); RunonceManager::createRunonce($this->io, $this->rootDir); $this->assertFileExists($this->rootDir . '/system/runonce.php', 'Runonce does not exist.'); $this->assertFileExists($this->rootDir . '/system/runonce_1.php', 'Secondary runonce does not exist.'); $file1 = file_get_contents($this->rootDir . '/system/runonce.php'); $file2 = file_get_contents($this->rootDir . '/system/runonce_1.php'); $this->assertEquals($testData, $file2, 'Test runonce should have been moved to runonce_1.php'); $this->assertContains('system/runonce_1.php', $file1, 'Previous runonce has not been added.'); $this->assertContains('composer/vendor/unit/test/runonce2.php', $file1, 'runonce2 from module has not been added.'); $this->assertNotContains('composer/vendor/unit/test/runonce1.php', $file1, 'runonce1 is also mentioned in new runonce.php'); }
/** * Handle post update events. * * @return void */ public function handlePostUpdateCmd() { $package = $this->composer->getPackage(); $root = $this->getContaoRoot($package); RunonceManager::createRunonce($this->inputOutput, $root); Housekeeper::cleanCache($this->inputOutput, $root); }