Skip to content

Commit

Permalink
add wiring test
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul M. Jones committed Jan 30, 2013
1 parent 6a419ae commit c79e8d3
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/WiringTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
namespace Aura\Cli;

use Aura\Framework\Test\WiringAssertionsTrait;

class WiringTest extends \PHPUnit_Framework_TestCase
{
use WiringAssertionsTrait;

protected function setUp()
{
$this->loadDi();
}

public function testServices()
{
$this->assertGet('cli_context', 'Aura\Cli\Context');
$this->assertGet('cli_stdio', 'Aura\Cli\Stdio');
}

public function testInstances()
{
$this->assertNewInstance('Aura\Cli\AbstractCommand', 'Aura\Cli\MockCommand');
$this->assertNewInstance('Aura\Cli\Context');
$this->assertNewInstance('Aura\Cli\ExceptionFactory');
$this->assertNewInstance('Aura\Cli\Getopt');
$this->assertNewInstance('Aura\Cli\Stdio');
}

public function testTranslatedExceptions()
{
$factory = $this->di->newInstance('Aura\Cli\ExceptionFactory');
$exception = $factory->newInstance('ERR_OPTION_NOT_DEFINED');
$expect = "The option '{option}' is not recognized.";
$actual = $exception->getMessage();
$this->assertSame($expect, $actual);
}
}

0 comments on commit c79e8d3

Please sign in to comment.