Skip to content

Commit 51f329d

Browse files
committed
add more tests for command()
1 parent 3fa804c commit 51f329d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/system/Commands/HelpCommandTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter\Commands;
1515

16+
use CodeIgniter\CodeIgniter;
1617
use CodeIgniter\Test\CIUnitTestCase;
1718
use CodeIgniter\Test\StreamFilterTrait;
1819
use PHPUnit\Framework\Attributes\Group;
@@ -63,4 +64,26 @@ public function testHelpCommandOnInexistentCommandButWithAlternatives(): void
6364
$this->assertStringContainsString('Command "clear" not found.', $this->getBuffer());
6465
$this->assertStringContainsString('Did you mean one of these?', $this->getBuffer());
6566
}
67+
68+
public function testNormalHelpCommandHasNoBanner(): void
69+
{
70+
command('help');
71+
72+
$this->assertStringNotContainsString(
73+
sprintf('CodeIgniter %s Command Line Tool', CodeIgniter::CI_VERSION),
74+
$this->getBuffer(),
75+
);
76+
$this->assertStringContainsString('Displays basic usage information.', $this->getBuffer());
77+
}
78+
79+
public function testHelpCommandWithDoubleHyphenStillRemovesBanner(): void
80+
{
81+
command('help -- list');
82+
83+
$this->assertStringNotContainsString(
84+
sprintf('CodeIgniter %s Command Line Tool', CodeIgniter::CI_VERSION),
85+
$this->getBuffer(),
86+
);
87+
$this->assertStringContainsString('Lists the available commands.', $this->getBuffer());
88+
}
6689
}

0 commit comments

Comments
 (0)