-
Notifications
You must be signed in to change notification settings - Fork 17
/
ConsoleApplicationTest.php
44 lines (38 loc) · 1.24 KB
/
ConsoleApplicationTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Cygnite\Console\Foundation\Application;
use Cygnite\Tests\Console\Commands\GreetCommand;
class ConsoleApplicationTest extends TestCase
{
public function tearDown()
{
m::close();
}
public function testConsoleApplicationInstance()
{
$this->assertInstanceOf('\Cygnite\Console\Foundation\Application', $this->getMockConsole());
}
public function testCraftConsoleApplicationReturnsCorrectNameAndVersion()
{
$app = $this->getMockConsole();
$this->assertEquals('Cygnite Framework: Craft Console Application', $app->getName());
$this->assertEquals('testing version', $app->getVersion());
}
protected function getMockConsole()
{
$container = m::mock('Cygnite\Container\Container');
return $this->getMockBuilder('Cygnite\Console\Foundation\Application')
->setMethods(['addCommandToParent'])
->setConstructorArgs([$container, 'testing version'])
->getMock();
}
}
class ConsoleApplication extends Application
{
protected $commandsStack = [];
public function resetCommandStack()
{
$this->commandsStack = [];
}
}