mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-28 18:50:11 +02:00
34 lines
802 B
PHP
34 lines
802 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Creational\StaticFactory\Tests;
|
|
|
|
use DesignPatterns\Creational\StaticFactory\StaticFactory;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class StaticFactoryTest extends TestCase
|
|
{
|
|
public function testCanCreateNumberFormatter()
|
|
{
|
|
$this->assertInstanceOf(
|
|
'DesignPatterns\Creational\StaticFactory\FormatNumber',
|
|
StaticFactory::factory('number')
|
|
);
|
|
}
|
|
|
|
public function testCanCreateStringFormatter()
|
|
{
|
|
$this->assertInstanceOf(
|
|
'DesignPatterns\Creational\StaticFactory\FormatString',
|
|
StaticFactory::factory('string')
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @expectedException \InvalidArgumentException
|
|
*/
|
|
public function testException()
|
|
{
|
|
StaticFactory::factory('object');
|
|
}
|
|
}
|