mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Use the proper test stream filter
This commit is contained in:
parent
4174a4c97d
commit
aa23b0eb73
@ -1,9 +1,10 @@
|
||||
<?php namespace CodeIgniter\Commands;
|
||||
|
||||
use Config\MockAppConfig;
|
||||
use Tests\Support\Config\MockAppConfig;
|
||||
use CodeIgniter\HTTP\UserAgent;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
use CodeIgniter\CLI\CommandRunner;
|
||||
use CodeIgniter\Test\Filters\CITestStreamFilter;
|
||||
|
||||
class CommandsTest extends \CIUnitTestCase
|
||||
{
|
||||
@ -12,8 +13,8 @@ class CommandsTest extends \CIUnitTestCase
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
CommandsTestStreamFilter::$buffer = '';
|
||||
$this->stream_filter = stream_filter_append(STDOUT, 'CommandsTestStreamFilter');
|
||||
CITestStreamFilter::$buffer = '';
|
||||
$this->stream_filter = stream_filter_append(STDOUT, 'CITestStreamFilter');
|
||||
|
||||
$this->env = new \CodeIgniter\Config\DotEnv(ROOTPATH);
|
||||
$this->env->load();
|
||||
@ -42,7 +43,7 @@ class CommandsTest extends \CIUnitTestCase
|
||||
public function testHelpCommand()
|
||||
{
|
||||
$this->runner->index(['help']);
|
||||
$result = CommandsTestStreamFilter::$buffer;
|
||||
$result = CITestStreamFilter::$buffer;
|
||||
|
||||
// make sure the result looks like a command list
|
||||
$this->assertContains('Displays basic usage information.', $result);
|
||||
@ -52,7 +53,7 @@ class CommandsTest extends \CIUnitTestCase
|
||||
public function testListCommands()
|
||||
{
|
||||
$this->runner->index(['list']);
|
||||
$result = CommandsTestStreamFilter::$buffer;
|
||||
$result = CITestStreamFilter::$buffer;
|
||||
|
||||
// make sure the result looks like a command list
|
||||
$this->assertContains('Lists the available commands.', $result);
|
||||
|
@ -1,9 +1,10 @@
|
||||
<?php namespace CodeIgniter\Commands;
|
||||
|
||||
use Config\MockAppConfig;
|
||||
use Tests\Support\Config\MockAppConfig;
|
||||
use CodeIgniter\HTTP\UserAgent;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
use CodeIgniter\CLI\CommandRunner;
|
||||
use CodeIgniter\Test\Filters\CITestStreamFilter;
|
||||
|
||||
class SessionsCommandsTest extends \CIUnitTestCase
|
||||
{
|
||||
@ -11,8 +12,8 @@ class SessionsCommandsTest extends \CIUnitTestCase
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
CommandsTestStreamFilter::$buffer = '';
|
||||
$this->stream_filter = stream_filter_append(STDOUT, 'CommandsTestStreamFilter');
|
||||
CITestStreamFilter::$buffer = '';
|
||||
$this->stream_filter = stream_filter_append(STDOUT, 'CITestStreamFilter');
|
||||
|
||||
$this->env = new \CodeIgniter\Config\DotEnv(ROOTPATH);
|
||||
$this->env->load();
|
||||
@ -41,7 +42,7 @@ class SessionsCommandsTest extends \CIUnitTestCase
|
||||
public function testCreateMigrationCommand()
|
||||
{
|
||||
$this->runner->index(['session:migration']);
|
||||
$result = CommandsTestStreamFilter::$buffer;
|
||||
$result = CITestStreamFilter::$buffer;
|
||||
|
||||
// make sure we end up with a migration class in the right place
|
||||
// or at least that we claim to have done so
|
||||
@ -58,7 +59,7 @@ class SessionsCommandsTest extends \CIUnitTestCase
|
||||
CLI::init();
|
||||
|
||||
$this->runner->index(['session:migration']);
|
||||
$result = CommandsTestStreamFilter::$buffer;
|
||||
$result = CITestStreamFilter::$buffer;
|
||||
|
||||
// make sure we end up with a migration class in the right place
|
||||
$this->assertContains('Created file:', $result);
|
||||
|
Loading…
x
Reference in New Issue
Block a user