mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-01 20:50:15 +02:00
Behavioral\Command restructured
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace DesignPatterns\Command;
|
namespace DesignPatterns\Behavioral\Command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class CommandInterface
|
* class CommandInterface
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace DesignPatterns\Command;
|
namespace DesignPatterns\Behavioral\Command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This concrete command calls "print" on the Receiver, but an external
|
* This concrete command calls "print" on the Receiver, but an external
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace DesignPatterns\Command;
|
namespace DesignPatterns\Behavioral\Command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoker is using the command given to it.
|
* Invoker is using the command given to it.
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace DesignPatterns\Command;
|
namespace DesignPatterns\Behavioral\Command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receiver is specific service with its own contract and can be only concrete
|
* Receiver is specific service with its own contract and can be only concrete
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace DesignPatterns\Tests\Command;
|
namespace DesignPatterns\Behavioral\Command\Tests;
|
||||||
|
|
||||||
use DesignPatterns\Command\Invoker;
|
use DesignPatterns\Behavioral\Command\Invoker;
|
||||||
use DesignPatterns\Command\Receiver;
|
use DesignPatterns\Behavioral\Command\Receiver;
|
||||||
use DesignPatterns\Command\HelloCommand;
|
use DesignPatterns\Behavioral\Command\HelloCommand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CommandTest has the role of the Client in the Command Pattern
|
* CommandTest has the role of the Client in the Command Pattern
|
||||||
@@ -12,12 +12,18 @@ use DesignPatterns\Command\HelloCommand;
|
|||||||
class CommandTest extends \PHPUnit_Framework_TestCase
|
class CommandTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Invoker
|
||||||
|
*/
|
||||||
protected $invoker;
|
protected $invoker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Receiver
|
||||||
|
*/
|
||||||
protected $receiver;
|
protected $receiver;
|
||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
// this is the context of the application
|
|
||||||
$this->invoker = new Invoker();
|
$this->invoker = new Invoker();
|
||||||
$this->receiver = new Receiver();
|
$this->receiver = new Receiver();
|
||||||
}
|
}
|
Reference in New Issue
Block a user