mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-06 06:57:25 +02:00
it was created the Creational namespace and append its patterns
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Singleton;
|
||||
namespace DesignPatterns\Creational\Singleton;
|
||||
|
||||
/**
|
||||
* class Singleton
|
||||
@@ -8,7 +8,7 @@ namespace DesignPatterns\Singleton;
|
||||
class Singleton
|
||||
{
|
||||
/**
|
||||
* @var cached reference to singleton instance
|
||||
* @var Singleton reference to singleton instance
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Tests\Singleton;
|
||||
namespace DesignPatterns\Creational\Singleton;
|
||||
|
||||
use DesignPatterns\Singleton\Singleton;
|
||||
use DesignPatterns\Creational\Singleton\Singleton;
|
||||
|
||||
/**
|
||||
* SingletonTest tests the singleton pattern
|
||||
@@ -13,7 +13,7 @@ class SingletonTest extends \PHPUnit_Framework_TestCase
|
||||
public function testUniqueness()
|
||||
{
|
||||
$firstCall = Singleton::getInstance();
|
||||
$this->assertInstanceOf('DesignPatterns\Singleton\Singleton', $firstCall);
|
||||
$this->assertInstanceOf('DesignPatterns\Creational\Singleton\Singleton', $firstCall);
|
||||
$secondCall = Singleton::getInstance();
|
||||
$this->assertSame($firstCall, $secondCall);
|
||||
}
|
Reference in New Issue
Block a user