mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 04:00:18 +02:00
use constant instead of string
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
|
||||
namespace DesignPatterns\Tests\FactoryMethod;
|
||||
|
||||
use DesignPatterns\FactoryMethod;
|
||||
use DesignPatterns\FactoryMethod\FactoryMethod;
|
||||
use DesignPatterns\FactoryMethod\GermanFactory;
|
||||
use DesignPatterns\FactoryMethod\ItalianFactory;
|
||||
|
||||
/**
|
||||
* FactoryMethodTest tests the factory method pattern
|
||||
@@ -14,20 +16,23 @@ use DesignPatterns\FactoryMethod;
|
||||
class FactoryMethodTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
protected $type = array('cheap', 'fast');
|
||||
protected $type = array(
|
||||
FactoryMethod::CHEAP,
|
||||
FactoryMethod::FAST
|
||||
);
|
||||
|
||||
public function getShop()
|
||||
{
|
||||
return array(
|
||||
array(new FactoryMethod\GermanFactory()),
|
||||
array(new FactoryMethod\ItalianFactory())
|
||||
array(new GermanFactory()),
|
||||
array(new ItalianFactory())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getShop
|
||||
*/
|
||||
public function testCreation(FactoryMethod\FactoryMethod $shop)
|
||||
public function testCreation(FactoryMethod $shop)
|
||||
{
|
||||
// this test method acts as a client for the factory. We don't care
|
||||
// about the factory, all we know is it can produce vehicle
|
||||
@@ -42,7 +47,7 @@ class FactoryMethodTest extends \PHPUnit_Framework_TestCase
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage spaceship is not a valid vehicle
|
||||
*/
|
||||
public function testUnknownType(FactoryMethod\FactoryMethod $shop)
|
||||
public function testUnknownType(FactoryMethod $shop)
|
||||
{
|
||||
$shop->create('spaceship');
|
||||
}
|
||||
|
Reference in New Issue
Block a user