mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 01:32:22 +01:00
33 lines
763 B
PHP
33 lines
763 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Structural\Facade\Tests;
|
|
|
|
use DesignPatterns\Structural\Facade\Bios;
|
|
use DesignPatterns\Structural\Facade\Facade;
|
|
use DesignPatterns\Structural\Facade\OperatingSystem;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class FacadeTest extends TestCase
|
|
{
|
|
public function testComputerOn()
|
|
{
|
|
$os = $this->createMock(OperatingSystem::class);
|
|
|
|
$os->method('getName')
|
|
->will($this->returnValue('Linux'));
|
|
|
|
$bios = $this->createMock(Bios::class);
|
|
|
|
$bios->method('launch')
|
|
->with($os);
|
|
|
|
/** @noinspection PhpParamsInspection */
|
|
$facade = new Facade($bios, $os);
|
|
$facade->turnOn();
|
|
|
|
$this->assertSame('Linux', $os->getName());
|
|
}
|
|
}
|