<?phpnamespaceDesignPatterns\Structural\Facade\Tests;useDesignPatterns\Structural\Facade\Facade;useDesignPatterns\Structural\Facade\OsInterface;usePHPUnit\Framework\TestCase;classFacadeTestextendsTestCase{publicfunctiontestComputerOn(){/** @var OsInterface|\PHPUnit_Framework_MockObject_MockObject $os */$os=$this->createMock('DesignPatterns\Structural\Facade\OsInterface');$os->method('getName')->will($this->returnValue('Linux'));$bios=$this->getMockBuilder('DesignPatterns\Structural\Facade\BiosInterface')->setMethods(['launch','execute','waitForKeyPress'])->disableAutoload()->getMock();$bios->expects($this->once())->method('launch')->with($os);$facade=newFacade($bios,$os);// the facade interface is simple$facade->turnOn();// but you can also access the underlying components$this->assertEquals('Linux',$os->getName());}}