friendica-github/tests/ConsoleTestCase.php

45 lines
927 B
PHP
Raw Permalink Normal View History

<?php
2024-08-24 12:31:41 +00:00
// Copyright (C) 2010-2024, the Friendica project
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
2024-12-14 08:16:37 +00:00
namespace Friendica\Test;
use Asika\SimpleConsole\Console;
2024-12-11 22:45:17 +00:00
use Friendica\Test\MockedTestCase;
use Friendica\Test\Util\Intercept;
2024-12-14 08:16:37 +00:00
abstract class ConsoleTestCase extends MockedTestCase
{
/**
* @var array The default argv for a Console Instance
*/
protected $consoleArgv = [ 'consoleTest.php' ];
protected function setUp() : void
{
parent::setUp();
Intercept::setUp();
}
/**
* Dumps the execution of an console output to a string and returns it
*
* @param Console $console The current console instance
*
* @return string the output of the execution
*/
protected function dumpExecute(Console $console)
{
Intercept::reset();
$console->execute();
$returnStr = Intercept::$cache;
Intercept::reset();
return $returnStr;
}
}