Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
enumag committed Mar 9, 2017
1 parent fe38199 commit 860df1e
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/integration/src/ContainerAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Integration;

use Arachne\Codeception\Module\NetteDIModule;
use Arachne\ContainerAdapter\ContainerAdapter;
use Codeception\Test\Unit;
use DateTime;
Expand All @@ -14,6 +15,11 @@
*/
class ContainerAdapterTest extends Unit
{
/**
* @var NetteDIModule
*/
protected $tester;

/**
* @var ContainerAdapter
*/
Expand All @@ -28,13 +34,17 @@ public function testGet()
{
$this->assertInstanceOf(Container::class, $this->containerAdapter->get('container'));

$this->tester->expectException(ServiceNotFoundException::class, function () {
try {
$this->containerAdapter->get('nonexistent');
});
$this->fail();
} catch (ServiceNotFoundException $e) {
}

$this->tester->expectException(ServiceNotFoundException::class, function () {
try {
$this->containerAdapter->get('nonexistent', ContainerAdapter::EXCEPTION_ON_INVALID_REFERENCE);
});
$this->fail();
} catch (ServiceNotFoundException $e) {
}

$this->assertNull($this->containerAdapter->get('nonexistent', ContainerAdapter::NULL_ON_INVALID_REFERENCE));
}
Expand Down Expand Up @@ -70,9 +80,11 @@ public function testGetParameter()
{
$this->assertFalse($this->containerAdapter->getParameter('debugMode'));

$this->tester->expectException(InvalidArgumentException::class, function () {
try {
$this->containerAdapter->getParameter('nonexistent');
});
$this->fail();
} catch (InvalidArgumentException $e) {
}
}

public function testHasParameter()
Expand Down

0 comments on commit 860df1e

Please sign in to comment.