mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-06 06:57:25 +02:00
create a Test folder for each pattern
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?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());
|
||||
}
|
||||
}
|
3
Structural/DependencyInjection/Tests/config.php
Normal file
3
Structural/DependencyInjection/Tests/config.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
return array('host' => 'github.com');
|
Reference in New Issue
Block a user