mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 12:10:10 +02:00
Behavioral\Command restructured
This commit is contained in:
37
Behavioral/Command/Tests/CommandTest.php
Normal file
37
Behavioral/Command/Tests/CommandTest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\Command\Tests;
|
||||
|
||||
use DesignPatterns\Behavioral\Command\Invoker;
|
||||
use DesignPatterns\Behavioral\Command\Receiver;
|
||||
use DesignPatterns\Behavioral\Command\HelloCommand;
|
||||
|
||||
/**
|
||||
* CommandTest has the role of the Client in the Command Pattern
|
||||
*/
|
||||
class CommandTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Invoker
|
||||
*/
|
||||
protected $invoker;
|
||||
|
||||
/**
|
||||
* @var Receiver
|
||||
*/
|
||||
protected $receiver;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->invoker = new Invoker();
|
||||
$this->receiver = new Receiver();
|
||||
}
|
||||
|
||||
public function testInvocation()
|
||||
{
|
||||
$this->invoker->setCommand(new HelloCommand($this->receiver));
|
||||
$this->expectOutputString('Hello World');
|
||||
$this->invoker->run();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user