mirror of
https://github.com/friendica/friendica
synced 2025-04-23 23:50:12 +00:00
Config Console Tests (#5621)
* Config Console Tests - `MultiUseConsole` is now a testable console - `ConsoleTest` is a abstract TestClass for console tests - `ConfigConsoleTest` tests the config console commands * disable preserve global state because of smarty * fixed requires & basepath für Console Test
This commit is contained in:
parent
1711f4dc56
commit
4eaeea7889
4 changed files with 201 additions and 0 deletions
48
tests/src/Core/Console/ConsoleTest.php
Normal file
48
tests/src/Core/Console/ConsoleTest.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Core\Console;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Test\Util\Intercept;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
abstract class ConsoleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var MultiUseConsole Extension of the basic Friendica Console for testing purpose
|
||||
*/
|
||||
private $console;
|
||||
/**
|
||||
* @var App The Friendica App
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
protected $stdout;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Intercept::setUp();
|
||||
|
||||
if (!getenv('MYSQL_DATABASE')) {
|
||||
$this->markTestSkipped('Please set the MYSQL_* environment variables to your test database credentials.');
|
||||
}
|
||||
|
||||
// Reusable App object
|
||||
$this->app = BaseObject::getApp();
|
||||
$this->console = new MultiUseConsole();
|
||||
}
|
||||
|
||||
public function execute($args) {
|
||||
Intercept::reset();
|
||||
$this->console->reset();
|
||||
$this->console->parseTestArgv($args);
|
||||
$this->console->execute();
|
||||
|
||||
$returnStr = Intercept::$cache;
|
||||
Intercept::reset();
|
||||
return $returnStr;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue