/** * @dataProvider data_factory_parseSuccess */ public function test_factory_parse_minus($text, Period $expected) { $p = null; try { $p = Period::parse("-" . $text); } catch (DateTimeParseException $ex) { $this->assertEquals($expected->getYears() == Integer::MIN_VALUE || $expected->getMonths() == Integer::MIN_VALUE || $expected->getDays() == Integer::MIN_VALUE, true); return; } // not inside try/catch or it breaks test $this->assertEquals($p, $expected->negated()); }