public function testCanCreateHtmlText() { $factory = new HtmlFactory(); $text = $factory->createText('foobar'); $this->assertInstanceOf('DesignPatterns\\Creational\\AbstractFactory\\HtmlText', $text); }
public function testRenderText() { $type = 'text'; $media = HtmlFactory::getInstance($type); $this->assertEquals($type, $media->render()); }
<?php require './vendor/autoload.php'; use DesignPatterns\Creational\AbstractFactory\HtmlFactory; $mediaType = 'text'; $media = HtmlFactory::getInstance($mediaType); $media->render();