PHP7 NullObject

This commit is contained in:
Dominik Liebler
2016-09-22 10:43:27 +02:00
parent 01007ec5a8
commit b707bf064e
5 changed files with 10 additions and 44 deletions

View File

@@ -6,17 +6,12 @@ use DesignPatterns\Behavioral\NullObject\NullLogger;
use DesignPatterns\Behavioral\NullObject\PrintLogger;
use DesignPatterns\Behavioral\NullObject\Service;
/**
* LoggerTest tests for different loggers.
*/
class LoggerTest extends \PHPUnit_Framework_TestCase
{
public function testNullObject()
{
// one can use a singleton for NullObjet : I don't think it's a good idea
// because the purpose behind null object is to "avoid special case".
$service = new Service(new NullLogger());
$this->expectOutputString(null); // no output
$this->expectOutputString(null);
$service->doSomething();
}