mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-25 10:43:44 +02:00
34 lines
743 B
PHP
34 lines
743 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Structural\Adapter\Tests;
|
|
|
|
use DesignPatterns\Structural\Adapter\PaperBook;
|
|
use DesignPatterns\Structural\Adapter\EBookAdapter;
|
|
use DesignPatterns\Structural\Adapter\Kindle;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class AdapterTest extends TestCase
|
|
{
|
|
public function testCanTurnPageOnBook()
|
|
{
|
|
$book = new PaperBook();
|
|
$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());
|
|
}
|
|
}
|