Skip to content

Commit 0c774a8

Browse files
create a Test folder for each pattern
1 parent 14a9dfe commit 0c774a8

File tree

31 files changed

+43
-36
lines changed

31 files changed

+43
-36
lines changed

Behavioral/ChainOfResponsibilities/ChainTest.php Behavioral/ChainOfResponsibilities/Tests/ChainTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\ChainOfResponsibilities;
3+
namespace DesignPatterns\Behavioral\ChainOfResponsibilities\Tests;
44

55
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
66
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage;

Behavioral/Command/CommandTest.php Behavioral/Command/Tests/CommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\Command;
3+
namespace DesignPatterns\Behavioral\Command\Tests;
44

55
use DesignPatterns\Behavioral\Command\Invoker;
66
use DesignPatterns\Behavioral\Command\Receiver;

Behavioral/Iterator/IteratorTest.php Behavioral/Iterator/Tests/IteratorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\Iterator;
3+
namespace DesignPatterns\Behavioral\Iterator\Tests;
44

55
use DesignPatterns\Behavioral\Iterator\Book;
66
use DesignPatterns\Behavioral\Iterator\BookList;

Behavioral/Mediator/MediatorTest.php Behavioral/Mediator/Tests/MediatorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Tests\Mediator;
3+
namespace DesignPatterns\Tests\Mediator\Tests;
44

55
use DesignPatterns\Behavioral\Mediator\Mediator;
66
use DesignPatterns\Behavioral\Mediator\Subsystem\Database;

Behavioral/Memento/MementoTest.php Behavioral/Memento/Tests/MementoTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\Memento;
3+
namespace DesignPatterns\Behavioral\Memento\Tests;
4+
5+
use DesignPatterns\Behavioral\Memento\Originator;
46

57
/**
68
* MementoTest tests the memento pattern

Behavioral/NullObject/LoggerTest.php Behavioral/NullObject/Tests/LoggerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\NullObject;
3+
namespace DesignPatterns\Behavioral\NullObject\Tests;
44

55
use DesignPatterns\Behavioral\NullObject\NullLogger;
66
use DesignPatterns\Behavioral\NullObject\Service;

Behavioral/Observer/ObserverTest.php Behavioral/Observer/Tests/ObserverTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\Observer;
3+
namespace DesignPatterns\Behavioral\Observer\Tests;
44

55
use DesignPatterns\Behavioral\Observer\UserObserver;
66
use DesignPatterns\Behavioral\Observer\User;

Behavioral/Specification/SpecificationTest.php Behavioral/Specification/Tests/SpecificationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\Specification;
3+
namespace DesignPatterns\Behavioral\Specification\Tests;
44

55
use DesignPatterns\Behavioral\Specification\PriceSpecification;
66
use DesignPatterns\Behavioral\Specification\Item;

Behavioral/Strategy/StrategyTest.php Behavioral/Strategy/Tests/StrategyTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\Strategy;
3+
namespace DesignPatterns\Behavioral\Strategy\Tests;
44

55
use DesignPatterns\Behavioral\Strategy\DateComparator;
66
use DesignPatterns\Behavioral\Strategy\IdComparator;

Behavioral/TemplateMethod/JourneyTest.php Behavioral/TemplateMethod/Tests/JourneyTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Behavioral\TemplateMethod;
3+
namespace DesignPatterns\Behavioral\TemplateMethod\Tests;
44

55
use DesignPatterns\Behavioral\TemplateMethod;
66

Behavioral/Visitor/VisitorTest.php Behavioral/Visitor/Tests/VisitorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Tests\Visitor;
3+
namespace DesignPatterns\Tests\Visitor\Tests;
44

55
use DesignPatterns\Behavioral\Visitor;
66

Creational/AbstractFactory/AbstractFactoryTest.php Creational/AbstractFactory/Tests/AbstractFactoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Creational\AbstractFactory;
3+
namespace DesignPatterns\Creational\AbstractFactory\Tests;
44

55
use DesignPatterns\Creational\AbstractFactory\AbstractFactory;
66
use DesignPatterns\Creational\AbstractFactory\HtmlFactory;

Creational/Builder/DirectorTest.php Creational/Builder/Tests/DirectorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Creational\Builder;
3+
namespace DesignPatterns\Creational\Builder\Tests;
44

55
use DesignPatterns\Creational\Builder\Director;
66
use DesignPatterns\Creational\Builder\CarBuilder;

Creational/FactoryMethod/FactoryMethodTest.php Creational/FactoryMethod/Tests/FactoryMethodTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Creational\FactoryMethod;
3+
namespace DesignPatterns\Creational\FactoryMethod\Tests;
44

55
use DesignPatterns\Creational\FactoryMethod\FactoryMethod;
66
use DesignPatterns\Creational\FactoryMethod\GermanFactory;

Creational/Pool/PoolTest.php Creational/Pool/Tests/PoolTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22

3-
namespace DesignPatterns\Creational\Pool;
3+
namespace DesignPatterns\Creational\Pool\Tests;
4+
5+
use DesignPatterns\Creational\Pool\Pool;
46

57
class TestWorker
68
{
@@ -13,7 +15,7 @@ class PoolTest extends \PHPUnit_Framework_TestCase
1315

1416
public function testPool()
1517
{
16-
$pool = new Pool('DesignPatterns\Creational\Pool\TestWorker');
18+
$pool = new Pool('DesignPatterns\Creational\Pool\Tests\TestWorker');
1719
$worker = $pool->get();
1820

1921
$this->assertEquals(1, $worker->id);

Creational/SimpleFactory/SimpleFactoryTest.php Creational/SimpleFactory/Tests/SimpleFactoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Creational\SimpleFactory;
3+
namespace DesignPatterns\Creational\SimpleFactory\Tests;
44

55
use DesignPatterns\Creational\SimpleFactory\ConcreteFactory;
66

Creational/Singleton/SingletonTest.php Creational/Singleton/Tests/SingletonTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Creational\Singleton;
3+
namespace DesignPatterns\Creational\Singleton\Tests;
44

55
use DesignPatterns\Creational\Singleton\Singleton;
66

Creational/StaticFactory/StaticFactoryTest.php Creational/StaticFactory/Tests/StaticFactoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Creational\StaticFactory;
3+
namespace DesignPatterns\Creational\StaticFactory\Tests;
44

55
use DesignPatterns\Creational\StaticFactory\StaticFactory;
66

More/Delegation/DelegationTest.php More/Delegation/Tests/DelegationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\More\Delegation;
3+
namespace DesignPatterns\More\Delegation\Tests;
44

55
use DesignPatterns\More\Delegation;
66

More/ServiceLocator/ServiceLocatorTest.php More/ServiceLocator/Tests/ServiceLocatorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\More\ServiceLocator;
3+
namespace DesignPatterns\More\ServiceLocator\Tests;
44

55
use DesignPatterns\More\ServiceLocator\DatabaseService;
66
use DesignPatterns\More\ServiceLocator\LogService;

Structural/Adapter/AdapterTest.php Structural/Adapter/Tests/AdapterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Structural\Adapter;
3+
namespace DesignPatterns\Structural\Adapter\Tests;
44

55
use DesignPatterns\Structural\Adapter\EBookAdapter;
66
use DesignPatterns\Structural\Adapter\Kindle;

Structural/Bridge/BridgeTest.php Structural/Bridge/Tests/BridgeTest.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22

3-
namespace DesignPatterns\Structural\Bridge;
3+
namespace DesignPatterns\Structural\Bridge\Tests;
4+
5+
use DesignPatterns\Structural\Bridge\Assemble;
6+
use DesignPatterns\Structural\Bridge\Car;
7+
use DesignPatterns\Structural\Bridge\Motorcycle;
8+
use DesignPatterns\Structural\Bridge\Produce;
49

510
class BridgeTest extends \PHPUnit_Framework_TestCase
611
{

Structural/Composite/CompositeTest.php Structural/Composite/Tests/CompositeTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Test\Composite;
3+
namespace DesignPatterns\Test\Composite\Tests;
44

55
use DesignPatterns\Structural\Composite;
66

Structural/DataMapper/DataMapperTest.php Structural/DataMapper/Tests/DataMapperTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Structural\DataMapper;
3+
namespace DesignPatterns\Structural\DataMapper\Tests;
44

55
use DesignPatterns\Structural\DataMapper\UserMapper;
66
use DesignPatterns\Structural\DataMapper\User;

Structural/Decorator/DecoratorTest.php Structural/Decorator/Tests/DecoratorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Structural\Decorator;
3+
namespace DesignPatterns\Structural\Decorator\Tests;
44

55
use DesignPatterns\Structural\Decorator;
66

Structural/DependencyInjection/DependencyInjectionTest.php Structural/DependencyInjection/Tests/DependencyInjectionTest.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
namespace DesignPatterns\Structural\DependencyInjection;
3+
namespace DesignPatterns\Structural\DependencyInjection\Tests;
44

5-
use DesignPatterns\Structural\DependencyInjection\Parameters;
6-
use DesignPatterns\Structural\DependencyInjection\AbstractConfig;
75
use DesignPatterns\Structural\DependencyInjection\ArrayConfig;
86
use DesignPatterns\Structural\DependencyInjection\Connection;
97

Structural/Facade/FacadeTest.php Structural/Facade/Tests/FacadeTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Structural\Facade;
3+
namespace DesignPatterns\Structural\Facade\Tests;
44

55
use DesignPatterns\Structural\Facade\Facade as Computer;
66

Structural/FluentInterface/FluentInterfaceTest.php Structural/FluentInterface/Tests/FluentInterfaceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Structural\FluentInterface;
3+
namespace DesignPatterns\Structural\FluentInterface\Tests;
44

55
use DesignPatterns\Structural\FluentInterface\Sql;
66

Structural/Registry/RegistryTest.php Structural/Registry/Tests/RegistryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace DesignPatterns\Structural\Registry;
3+
namespace DesignPatterns\Structural\Registry\Tests;
44

55
use DesignPatterns\Structural\Registry\Registry;
66

phpunit.xml.dist

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
<testsuites>
55
<testsuite name="Design Patterns">
6-
<directory suffix="Test.php">Behavioral</directory>
7-
<directory suffix="Test.php">Creational</directory>
8-
<directory suffix="Test.php">More</directory>
9-
<directory suffix="Test.php">Structural</directory>
6+
<directory suffix="Test.php">Behavioral/*/Tests</directory>
7+
<directory suffix="Test.php">Creational/*/Tests</directory>
8+
<directory suffix="Test.php">More/*/Tests</directory>
9+
<directory suffix="Test.php">Structural/*/Tests</directory>
1010
</testsuite>
1111
</testsuites>
1212
<filter>

0 commit comments

Comments
 (0)