Last active
February 4, 2020 05:44
-
-
Save bcremer/b89092da07a6aea7417b013bfe2f0d8e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace AppTest; | |
use PHPUnit\Framework\TestCase; | |
use Psr\Container\ContainerInterface; | |
use function assert; | |
use function strpos; | |
/** | |
* @coversNothing | |
*/ | |
final class ContainerTest extends TestCase | |
{ | |
public function testContainer() : void | |
{ | |
$container = require __DIR__ . '/../config/container.php'; | |
assert($container instanceof ContainerInterface); | |
foreach ($container->get('config')['dependencies']['factories'] as $id => $factory) { | |
if (strpos($id, 'App\\') !== 0) { // only instanciate services in application namespace, no third party libs | |
continue; | |
} | |
$instance = $container->get($id); | |
self::assertInstanceOf($id, $instance); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment