Пример #1
0
 /**
  * Has the site installed composer with --dev option
  * @return bool
  */
 public static function are_behat_dependencies_installed()
 {
     if (!is_dir(get_composerroot_dir() . '/vendor/behat')) {
         return false;
     }
     return true;
 }
Пример #2
0
/**
 * Updates the composer installer and the dependencies.
 *
 * Includes --dev dependencies.
 *
 * @return void exit() if something goes wrong
 */
function testing_update_composer_dependencies()
{
    // To restore the value after finishing.
    $cwd = getcwd();
    // Directory to install PHP composer
    $composerroot = get_composerroot_dir();
    chdir($composerroot);
    // Download composer.phar if we can.
    if (!file_exists($composerroot . '/composer.phar')) {
        passthru("curl http://getcomposer.org/installer | php", $code);
        if ($code != 0) {
            exit($code);
        }
    } else {
        // If it is already there update the installer.
        passthru("php composer.phar self-update", $code);
        if ($code != 0) {
            exit($code);
        }
    }
    // Install/update composer dependencies.
    passthru("php composer.phar install", $code);
    if ($code != 0) {
        exit($code);
    }
    chdir($cwd);
}