mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-21 16:52:49 +02:00
26 lines
676 B
PHP
26 lines
676 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Structural\DependencyInjection\Tests;
|
|
|
|
use DesignPatterns\Structural\DependencyInjection\ArrayConfig;
|
|
use DesignPatterns\Structural\DependencyInjection\Connection;
|
|
|
|
class DependencyInjectionTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
protected $config;
|
|
protected $source;
|
|
|
|
public function setUp()
|
|
{
|
|
$this->source = include 'config.php';
|
|
$this->config = new ArrayConfig($this->source);
|
|
}
|
|
|
|
public function testDependencyInjection()
|
|
{
|
|
$connection = new Connection($this->config);
|
|
$connection->connect();
|
|
$this->assertEquals($this->source['host'], $connection->getHost());
|
|
}
|
|
}
|