mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-05 05:24:57 +02:00
31 lines
698 B
PHP
31 lines
698 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Structural\Adapter\Tests;
|
|
|
|
use DesignPatterns\Structural\Adapter\Book;
|
|
use DesignPatterns\Structural\Adapter\EBookAdapter;
|
|
use DesignPatterns\Structural\Adapter\Kindle;
|
|
|
|
class AdapterTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testCanTurnPageOnBook()
|
|
{
|
|
$book = new Book();
|
|
$book->open();
|
|
$book->turnPage();
|
|
|
|
$this->assertEquals(2, $book->getPage());
|
|
}
|
|
|
|
public function testCanTurnPageOnKindleLikeInANormalBook()
|
|
{
|
|
$kindle = new Kindle();
|
|
$book = new EBookAdapter($kindle);
|
|
|
|
$book->open();
|
|
$book->turnPage();
|
|
|
|
$this->assertEquals(2, $book->getPage());
|
|
}
|
|
}
|