mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-12 19:06:24 +02:00
32 lines
707 B
PHP
32 lines
707 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Structural\Adapter\Tests;
|
|
|
|
use DesignPatterns\Structural\Adapter\Book;
|
|
use DesignPatterns\Structural\Adapter\EBookAdapter;
|
|
use DesignPatterns\Structural\Adapter\Kindle;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class AdapterTest extends TestCase
|
|
{
|
|
public function testCanTurnPageOnBook()
|
|
{
|
|
$book = new Book();
|
|
$book->open();
|
|
$book->turnPage();
|
|
|
|
$this->assertSame(2, $book->getPage());
|
|
}
|
|
|
|
public function testCanTurnPageOnKindleLikeInANormalBook()
|
|
{
|
|
$kindle = new Kindle();
|
|
$book = new EBookAdapter($kindle);
|
|
|
|
$book->open();
|
|
$book->turnPage();
|
|
|
|
$this->assertSame(2, $book->getPage());
|
|
}
|
|
}
|