예제 #1
0
 public function testPrepareReciepe()
 {
     $tea = new Tea();
     $expected = "Boiling water.\n";
     $expected .= "Steeping the tea.\n";
     $expected .= "Pouring into cup.\n";
     $expected .= "Adding lemon.\n";
     $this->assertEquals($expected, $tea->prepareReceipe());
 }
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Kondrat\DesignPatterns\TemplateMethod\Coffee;
use Kondrat\DesignPatterns\TemplateMethod\Tea;
$coffee = new Coffee();
$tea = new Tea();
echo "<pre>";
echo "Preparing coffee...\n";
echo $coffee->prepareReceipe();
echo "\n\n";
echo "Preparing tea...\n";
echo $tea->prepareReceipe();