Пример #1
0
 /**
  */
 public function testRunTask()
 {
     $mock = $this->getMock("\\Idephix\\PassTester");
     $mock->expects($this->exactly(1))->method('pass')->with('foo');
     $this->idx->add('command_name', function ($param) use($mock) {
         $mock->pass($param);
         return 0;
     });
     $this->assertEquals(0, $this->idx->runTask('command_name', 'foo'));
 }
Пример #2
0
<?php

use Idephix\Idephix;
use Idephix\Extension\Deploy\Deploy;
use Idephix\Extension\PHPUnit\PHPUnit;
use Idephix\SSH\SshClient;
$idx = new Idephix();
$build = function () use($idx) {
    $idx->local('composer install --prefer-source');
    $idx->local('bin/phpunit -c tests');
};
$buildTravis = function () use($idx) {
    $idx->local('composer install --prefer-source');
    $idx->local('bin/phpunit -c tests --coverage-clover=clover.xml');
    $idx->runTask('createPhar');
};
$deployPhar = function () use($idx) {
    $idx->output->writeln('Releasing new phar version...');
    if (!file_exists('./idephix.phar')) {
        $idx->output->writeln('Idephix phar does not exists');
        exit(-1);
    }
    $new_version = $idx->local('cat .git/refs/heads/master');
    $commit_msg = trim($idx->local('git log -1 --pretty=%B'));
    if (false === strpos($commit_msg, '[release]')) {
        $idx->output->writeln("skipping, commit msg was '{$commit_msg}'");
        exit(0);
    }
    $current_version = file_get_contents('https://raw.githubusercontent.com/ideatosrl/getidephix.com/gh-pages/version');
    if ($new_version == $current_version) {
        $idx->output->writeln("version {$new_version} already deployed");
Пример #3
0
    }
    $idx->remotePrepare();
    $idx->getStrategy()->deploy();
    $idx->remoteLinkSharedFolders();
    if ($idx->hasToMigrate()) {
        $idx->doctrineMigrate();
    }
    $idx->remote('cd ' . $idx->getNextReleaseFolder() . '/app/config && rm -f parameters.yml', !$go);
    $idx->remote('cd ' . $idx->getNextReleaseFolder() . '/app/config && ln -s parameters.' . $env . '.yml parameters.yml', !$go);
    $idx->cacheClear();
    $idx->switchToTheNextRelease();
    $idx->assetic();
    $idx->deleteOldReleases(6);
    $idx->remote('cd ' . $idx->getNextReleaseFolder() . ' && rm -Rf app/cache/*', !$go);
})->add('test:run', function ($filter = '') use($idx) {
    $idx->runTask('test:run-group', 'unit', $filter);
    $idx->runTask('test:run-group', 'integration', $filter);
    $idx->runTask('test:run-group', 'command', $filter);
    $idx->runTask('test:run-group', 'functional', $filter);
    $idx->runTask('test:run-group', 'functionalAdmin', $filter);
})->add('test:run-group', function ($group, $filter = "") use($idx) {
    if (!empty($filter)) {
        $filter = ' --filter ' . $filter;
    }
    try {
        $idx->local('bin/phpunit -c app/ --stderr --group=' . $group . " " . $filter);
    } catch (\Exception $e) {
        exit(1);
    }
})->add('project:build', function () use($idx) {
    $cwd = getcwd();