diff --git a/Tests/Facade/FacadeTest.php b/Tests/Facade/FacadeTest.php new file mode 100644 index 0000000..85e3f95 --- /dev/null +++ b/Tests/Facade/FacadeTest.php @@ -0,0 +1,51 @@ +getMockBuilder('DesignPatterns\Facade\BiosInterface') + ->setMethods(array('launch', 'execute', 'waitForKeyPress')) + ->disableAutoload() + ->getMock(); + $operatingSys = $this->getMockBuilder('DesignPatterns\Facade\OsInterface') + ->setMethods(array('getName')) + ->disableAutoload() + ->getMock(); + $bios->expects($this->once()) + ->method('launch') + ->with($operatingSys); + $operatingSys + ->expects($this->once()) + ->method('getName') + ->will($this->returnValue('Linux')); + + $facade = new Computer($bios, $operatingSys); + return array(array($facade, $operatingSys)); + } + + /** + * @dataProvider getComputer + */ + public function testComputerOn(Computer $facade, $os) + { + // interface is simpler : + $facade->turnOn(); + // but I can access to lower component + $this->assertEquals('Linux', $os->getName()); + } + +} \ No newline at end of file