コード例 #1
0
ファイル: class.processes.php プロジェクト: rrsc/processmaker
    /**

     * Update a Process register in DB, if the process doesn't exist with the same

     * uid of the $row['PRO_UID'] parameter the function creates a new one based

     * on the $row parameter data.

     *

     * @param $row array parameter with the process data

     * @return $oProcess Process object

     */

    public function updateProcessRow ($row)

    {

        $oProcess = new Process();

        if ($oProcess->processExists( $row['PRO_UID'] )) {

            $oProcess->update( $row );

        } else {

            $oProcess->create( $row );

        }

    }
コード例 #2
0
 public function createProcess($aData)
 {
     try {
         $oProcess = new Process();
         return $oProcess->create($aData);
     } catch (Exception $oError) {
         throw $oError;
     }
 }
コード例 #3
0
ファイル: given.php プロジェクト: nb/wp-cli
    $wp_config_path = $world->variables['RUN_DIR'] . "/wp-config.php";
    $wp_config_code = file_get_contents($wp_config_path);
    $world->move_files('wp-content', 'my-content');
    $world->add_line_to_wp_config($wp_config_code, "define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/my-content' );");
    $world->move_files('my-content/plugins', 'my-plugins');
    $world->add_line_to_wp_config($wp_config_code, "define( 'WP_PLUGIN_DIR', __DIR__ . '/my-plugins' );");
    file_put_contents($wp_config_path, $wp_config_code);
});
$steps->Given('/^download:$/', function ($world, TableNode $table) {
    foreach ($table->getHash() as $row) {
        $path = $world->replace_variables($row['path']);
        if (file_exists($path)) {
            // assume it's the same file and skip re-download
            continue;
        }
        \Process::create(\WP_CLI\Utils\esc_cmd('curl -sSL %s > %s', $row['url'], $path))->run_check();
    }
});
$steps->Given('/^save (STDOUT|STDERR)( [\'].+[^\'])? as \\{(\\w+)\\}$/', function ($world, $stream, $output_filter, $key) {
    if ($output_filter) {
        $output_filter = '/' . trim(str_replace('%s', '(.+[^\\b])', $output_filter), "' ") . '/';
        if (false !== preg_match($output_filter, $world->result->{$stream}, $matches)) {
            $output = array_pop($matches);
        } else {
            $output = '';
        }
    } else {
        $output = $world->result->{$stream};
    }
    $world->variables[$key] = trim($output, "\n");
});
コード例 #4
0
ファイル: when.php プロジェクト: nb/wp-cli
<?php

use Behat\Gherkin\Node\PyStringNode, Behat\Gherkin\Node\TableNode;
function invoke_proc($proc, $mode, $subdir = null)
{
    $map = array('run' => 'run_check', 'try' => 'run');
    $method = $map[$mode];
    return $proc->{$method}($subdir);
}
$steps->When('/^I (run|try) `([^`]+)`$/', function ($world, $mode, $cmd) {
    $cmd = $world->replace_variables($cmd);
    $world->result = invoke_proc($world->proc($cmd), $mode);
});
$steps->When("/^I (run|try) `([^`]+)` from '([^\\s]+)'\$/", function ($world, $mode, $cmd, $subdir) {
    $cmd = $world->replace_variables($cmd);
    $world->result = invoke_proc($world->proc($cmd), $mode, $subdir);
});
$steps->When('/^I (run|try) the previous command again$/', function ($world, $mode) {
    if (!isset($world->result)) {
        throw new \Exception('No previous command.');
    }
    $proc = Process::create($world->result->command, $world->result->cwd, $world->result->env);
    $world->result = invoke_proc($proc, $mode);
});
コード例 #5
0
    //#30
    $t->isa_ok($e, 'Exception', 'remove() returns error when UID is not defined');
    //#31
    //$t->is ( $e->getMessage(),   "This row doesn't exist!",   "remove() This row doesn't exist!" );
    $t->todo($e->getMessage() . "  <> The row ''in table Process doesn't exist! " . "     line 213");
}
//remove with $fields
$Fields['PRO_UID'] = $proUid;
try {
    $obj = new Process();
    $res = $obj->remove($Fields);
    //#32
    $t->is($res, NULL, "remove() remove row {$proUid}");
} catch (Exception $e) {
    //#14
    $t->isa_ok($e, 'PropelException', 'remove() return error ' . $e->getMessage());
}
//remove with $proUid
$obj = new Process();
$proUid = $obj->create('1');
try {
    $obj = new Process();
    $res = $obj->remove($proUid);
    //#33
    $t->is($res, NULL, "remove() remove row {$proUid}");
} catch (Exception $e) {
    //#14
    $t->isa_ok($e, 'PropelException', 'remove() return error ' . $e->getMessage());
}
$t->todo('Test to verify if delete works correctly :p ...');
$t->todo('how can I change dynamically the Case Title based in a definition, right now the case title is the same as the process title.  We need another field in process to have the case title definition');
コード例 #6
0
ファイル: FeatureContext.php プロジェクト: nb/wp-cli
 public function download_wp($subdir = '')
 {
     $dest_dir = $this->variables['RUN_DIR'] . "/{$subdir}";
     if ($subdir) {
         mkdir($dest_dir);
     }
     Process::create(Utils\esc_cmd("cp -r %s/* %s", self::$cache_dir, $dest_dir))->run_check();
     // disable emailing
     mkdir($dest_dir . '/wp-content/mu-plugins');
     copy(__DIR__ . '/../extra/no-mail.php', $dest_dir . '/wp-content/mu-plugins/no-mail.php');
 }