createMock('DesignPatterns\Structural\Facade\OperatingSystem'); $os->method('getName') ->will($this->returnValue('Linux')); $bios = $this->getMockBuilder('DesignPatterns\Structural\Facade\Bios') ->setMethods(['launch', 'execute', 'waitForKeyPress']) ->disableAutoload() ->getMock(); $bios->expects($this->once()) ->method('launch') ->with($os); $facade = new Facade($bios, $os); // the facade interface is simple $facade->turnOn(); // but you can also access the underlying components $this->assertSame('Linux', $os->getName()); } }