public function testExtractWhenSomePropertyIsInvalid() { $this->qualifiedGerman->addProperty(new PropertyDefinition('variableDesk', new StringType())); $this->setExpectedException('Wookieb\\ZorroDataSchema\\Exception\\InvalidValueException', 'Cannot extract value of property "variableDesk"'); try { $this->qualifiedGerman->extract(new QualifiedGerman()); } catch (InvalidValueException $e) { $this->assertContains('Cannot extract data for property "variableDesk" since it not exist', $e->getPrevious()->getMessage()); throw $e; } }
/** * @dataProvider extractingExceptionDataProvider */ public function testExtractingExceptionData($exception, $expected) { $this->assertEquals($expected, $this->object->extract($exception)); }