mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-27 23:09:13 +02:00
it was created the Creational namespace and append its patterns
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Tests\Pool;
|
||||
|
||||
use DesignPatterns\Pool\Pool;
|
||||
|
||||
class TestWorker
|
||||
{
|
||||
|
||||
public $id = 1;
|
||||
|
||||
}
|
||||
|
||||
class PoolTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testPool()
|
||||
{
|
||||
$pool = new Pool('DesignPatterns\Tests\Pool\TestWorker');
|
||||
$worker = $pool->get();
|
||||
|
||||
$this->assertEquals(1, $worker->id);
|
||||
|
||||
$worker->id = 5;
|
||||
$pool->dispose($worker);
|
||||
|
||||
$this->assertEquals(5, $pool->get()->id);
|
||||
$this->assertEquals(1, $pool->get()->id);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user