Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4792649
CommandTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
CommandTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\Commands\Tests
;
use
Keruald\Commands\Command
;
use
Keruald\Commands\Display\ArrayDisplay
;
use
Keruald\Commands\ExitCode
;
use
PHPUnit\Framework\TestCase
;
class
CommandTest
extends
TestCase
{
/**
* @var Command
*/
private
$command
;
/**
* @var ArrayDisplay
*/
private
$display
;
public
function
setUp
()
{
$this
->
display
=
new
ArrayDisplay
();
$this
->
command
=
new
SunsetCommand
(
1
,
[
"sunset"
],
$this
->
display
);
}
public
function
testGetArgc
()
{
$this
->
assertEquals
(
1
,
$this
->
command
->
getArgc
());
}
public
function
testGetArgv
()
{
$this
->
assertEquals
([
"sunset"
],
$this
->
command
->
getArgv
());
}
public
function
testGetCommandName
()
{
$this
->
assertEquals
(
"sunset"
,
$this
->
command
->
getCommandName
());
}
public
function
testDisplayBeforeRun
()
{
$this
->
assertEmpty
(
$this
->
display
->
getOut
());
$this
->
assertEmpty
(
$this
->
display
->
getError
());
}
public
function
testDisplayAfterRun
()
{
$this
->
command
->
main
();
$this
->
assertEquals
(
1
,
$this
->
display
->
countOut
());
$this
->
assertEquals
(
0
,
$this
->
display
->
countError
());
}
public
function
testReturnCode
()
{
$this
->
assertEquals
(
ExitCode
::
SUCCESS
,
$this
->
command
->
main
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 20:14 (9 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2445679
Default Alt Text
CommandTest.php (1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment