Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.6 KiB

namespace Friendica\Test\src\Core\Console;
use Friendica\App;
use Friendica\BaseObject;
use Friendica\Database\DBA;
use Friendica\Test\Util\Intercept;
use Friendica\Test\Util\VFSTrait;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use PHPUnit\Framework\TestCase;
abstract class ConsoleTest extends TestCase
use VFSTrait;
* @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()
if (!getenv('MYSQL_DATABASE')) {
$this->markTestSkipped('Please set the MYSQL_* environment variables to your test database credentials.');
// fake console.php for setting an executable
->setContent('<? php');
// Reusable App object
$this->app = new App($this->root->url());
$this->console = new MultiUseConsole();
public function execute($args) {
array_unshift($args, $this->getExecutablePath());
$returnStr = Intercept::$cache;
return $returnStr;
* @return string returns the path to the console executable during tests
protected function getExecutablePath() {
return $this->root->getChild('bin' . DIRECTORY_SEPARATOR . 'console.php')->url();