removed ...Interface suffix and added 2nd service to Bridge example

This commit is contained in:
Dominik Liebler
2018-11-06 20:33:42 +01:00
parent b0ac02f01e
commit 617754573c
12 changed files with 145 additions and 659 deletions

View File

@@ -9,13 +9,17 @@ use PHPUnit\Framework\TestCase;
class BridgeTest extends TestCase
{
public function testCanPrintUsingThePlainTextPrinter()
public function testCanPrintUsingThePlainTextFormatter()
{
$service = new HelloWorldService(new PlainTextFormatter());
$this->assertSame('Hello World', $service->get());
// now change the implementation and use the HtmlFormatter instead
$service->setImplementation(new HtmlFormatter());
$this->assertSame('Hello World', $service->get());
}
public function testCanPrintUsingTheHtmlFormatter()
{
$service = new HelloWorldService(new HtmlFormatter());
$this->assertSame('<p>Hello World</p>', $service->get());
}
}