cookbook/tests/bootstrap.php

41 строка
1.0 KiB
PHP
Исходник Обычный вид История

2019-03-11 05:04:20 +03:00
<?php
require_once __DIR__ . '/../../../tests/bootstrap.php';
2019-03-11 05:04:20 +03:00
// Fix for "Autoload path not allowed: .../cookbook/tests/testcase.php"
\OC_App::loadApp('cookbook');
function resetEnvironmentToBackup(string $name = 'default', bool $forceprint = false) {
$output = [];
$ret = -1;
exec("./.github/actions/run-tests/reset-from-container.sh $name 2>&1", $output, $ret);
if ($ret !== 0 || $forceprint) {
echo "\nStandard output:\n";
print_r($output);
echo "Return value: $ret\n";
if ($ret !== 0) {
throw new Exception("Could not reset environment");
}
}
}
function runOCCCommand(array $args, bool $forceprint = false) {
$output = [];
$ret = -1;
$params = join(' ', array_map(function ($x) {
return escapeshellarg($x);
}, $args));
$cmd = "./.github/actions/run-tests/run-occ.sh $params 2>&1";
exec($cmd, $output, $ret);
if ($ret !== 0 || $forceprint) {
echo "\nStandard output:\n";
print_r($output);
echo "Return value: $ret\n";
if ($ret !== 0) {
throw new Exception("Could not run OCC command");
}
}
}