/** * @dataProvider anwserRepository */ public function testFactory($data, $class, $parent) { $object = AnwserFactory::createAnwser($data); if (is_object($object)) { $this->assertInstanceOf($class, $object); $this->assertInstanceOf($parent, $object); } else { $this->assertInternalType($class, $object); } }
/** * @dataProvider anwserRepository */ public function testAnwser($data, $class, $correct) { $object = AnwserFactory::createAnwser($data); $this->assertInstanceOf($class, $object); $this->assertEquals($correct, $object->isCorrect()); }
public function add($anwser) { $this->anwsers[] = AnwserFactory::createAnwser($anwser); }