Commit 82ccf938 authored by Matthias Larisch's avatar Matthias Larisch

Update CLI tests and environment

parent f890110c
Pipeline #41324674 passed with stages
in 17 minutes and 28 seconds
......@@ -14,7 +14,7 @@ require __DIR__ . '/../vendor/autoload.php';
*/
function initializeContainer()
{
$env = $_SERVER['FS_ENV'] ?? 'dev';
$env = $_SERVER['FS_ENV'] ?? getenv('FS_ENV') ?? 'dev';
$debug = (bool)($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));
$kernel = new FoodsharingKernel($env, $debug);
$kernel->boot();
......
......@@ -25,7 +25,6 @@ $method = 'index';
if (isset($argv[3]) && $argv[3] == 'quiet') {
define('QUIET', true);
} else {
define('QUIET', false);
}
if (isset($argv) && is_array($argv)) {
......@@ -44,7 +43,6 @@ $appInstance = $container->get(ltrim($app, '\\'));
if (is_callable([$appInstance, $method])) {
$appInstance->$method();
exit();
} else {
echo 'Modul ' . $app . ' konnte nicht geladen werden';
}
echo 'Modul ' . $app . ' konnte nicht geladen werden';
......@@ -95,7 +95,7 @@ class ConsoleControl
public static function error($msg)
{
if (defined('QUIET')) {
if (defined('QUIET') && QUIET == true) {
return false;
}
echo "\033[31m" . self::cliTime() . " [ERROR]\t" . $msg . " \033[0m\n";
......@@ -103,7 +103,7 @@ class ConsoleControl
public static function info($msg)
{
if (defined('QUIET')) {
if (defined('QUIET') && QUIET == true) {
return false;
}
//echo "\033[37m[INFO]\t" . $msg." \033[0m\n";
......@@ -112,7 +112,7 @@ class ConsoleControl
public static function success($msg)
{
if (defined('QUIET')) {
if (defined('QUIET') && QUIET == true) {
return false;
}
echo "\033[32m" . self::cliTime() . " [INFO]\t" . $msg . " \033[0m\n";
......
......@@ -2,7 +2,7 @@
$I = new CliTester($scenario);
$I->am('Cron');
$I->wantTo('see that mailbox update method exists and starts, without caring for any errors');
$I->wantTo('see that CronCommand exists and starts, without caring for any errors');
$I->amInPath('');
$I->runShellCommand('php -f run.php Mails mailboxupdate', false);
$I->seeInShellOutput('::mailboxupdate...');
$I->runShellCommand('php -f bin/console foodsharing:cron', false);
$I->seeInShellOutput('mailscontrl');
......@@ -10,10 +10,10 @@ $I->seeInDatabase('fs_foodsaver', ['id' => $fsA['id'], 'deleted_at' => null]);
$I->seeInDatabase('fs_foodsaver', ['id' => $fsB['id'], 'deleted_at' => null]);
$I->seeInDatabase('fs_foodsaver', ['id' => $fsC['id'], 'deleted_at' => null]);
$I->amInPath('');
$I->runShellCommand('php -f run.php Lookup lookup tests/_data/emaillist.csv');
$I->runShellCommand('FS_ENV=test php -f run.php Lookup lookup tests/_data/emaillist.csv', false);
$I->seeInShellOutput($fsA['id'] . ',');
$I->seeInShellOutput($fsB['id'] . ',');
$I->runShellCommand('php -f run.php Lookup deleteOldUsers tests/_data/emaillist.csv');
$I->runShellCommand('FS_ENV=test php -f run.php Lookup deleteOldUsers tests/_data/emaillist.csv', false);
$a = $I->grabFromDatabase('fs_foodsaver', 'deleted_at', array('id' => $fsA['id']));
$I->assertNotNull($a);
......
......@@ -4,9 +4,9 @@ $I = new CliTester($scenario);
$I->am('Cron');
$I->wantTo('see that stat generation jobs do execute');
$I->amInPath('');
$I->runShellCommand('php -f run.php Stats bezirke');
$I->runShellCommand('php -f run.php Stats bezirke', false);
$I->seeInShellOutput('Statistik Auswertung für Bezirke');
$I->runShellCommand('php -f run.php Stats betriebe');
$I->runShellCommand('php -f run.php Stats betriebe', false);
$I->seeInShellOutput('::betriebe...');
$I->runShellCommand('php -f run.php Stats foodsaver');
$I->runShellCommand('php -f run.php Stats foodsaver', false);
$I->seeInShellOutput('::foodsaver...');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment