factory = new ConcreteFactory(); } public function getType() { return array( array('bicycle'), array('other') ); } /** * @dataProvider getType */ public function testCreation($type) { $obj = $this->factory->createVehicle($type); $this->assertInstanceOf('DesignPatterns\Creational\SimpleFactory\VehicleInterface', $obj); } /** * @expectedException \InvalidArgumentException */ public function testBadType() { $this->factory->createVehicle('car'); } }