From afcf985bdc71f050fd317bcf0c4f68cbd642a0e8 Mon Sep 17 00:00:00 2001 From: Trismegiste Date: Sun, 12 May 2013 12:31:03 +0200 Subject: [PATCH] a unit test for the builder pattern --- Tests/Builder/DirectorTest.php | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Tests/Builder/DirectorTest.php diff --git a/Tests/Builder/DirectorTest.php b/Tests/Builder/DirectorTest.php new file mode 100644 index 0000000..83e2234 --- /dev/null +++ b/Tests/Builder/DirectorTest.php @@ -0,0 +1,46 @@ +director = new Director(); + } + + public function getBuilder() + { + return array( + array(new CarBuilder()), + array(new BikeBuilder()) + ); + } + + /** + * Here we test the build process. Notice that the client don't know + * anything about the contrete builder. + * + * @dataProvider getBuilder + */ + public function testBuild(\DesignPatterns\Builder\Builder $builder) + { + $newVehicle = $this->director->build($builder); + $this->assertInstanceOf('DesignPatterns\Builder\Parts\Vehicle', $newVehicle); + } + +} \ No newline at end of file