Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F25244340
TestCase.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
TestCase.php
View Options
<?php
namespace
Nasqueron\Notifications\Tests\Console\Commands
;
use
Symfony\Component\Console\Tester\CommandTester
;
use
Nasqueron\Notifications\Tests\TestCase
as
BaseTestCase
;
use
Artisan
;
class
TestCase
extends
BaseTestCase
{
///
/// Commands test environment
///
/**
* @var Symfony\Component\Console\Command
*/
protected
$command
;
/**
* @var Symfony\Component\Console\Tester\CommandTester;
*/
protected
$tester
;
public
function
setUp
()
{
parent
::
setUp
();
$this
->
command
=
$this
->
findCommand
(
$this
->
class
);
$this
->
tester
=
new
CommandTester
(
$this
->
command
);
}
///
/// Helper methods to manipulate command arrays
///
/**
* Finds the first instance of the expected type in the specified array.
*
* @param mixed $expectedType The type to find among the array elements
* @param array $haystack The array where to find
* @return mixed|null If not found, null. Otherwise, the found item.
*/
protected
static
function
findInstanceOf
(
$expectedType
,
$haystack
)
{
foreach
(
$haystack
as
$item
)
{
if
(
$item
instanceof
$expectedType
)
{
return
$item
;
}
}
return
null
;
}
protected
function
findCommand
(
$expectedType
)
{
return
self
::
findInstanceOf
(
$expectedType
,
Artisan
::
all
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Apr 9, 02:37 (22 m, 53 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3598972
Default Alt Text
TestCase.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment