/** * @dataProvider data_with_longTemporalField */ public function test_with_longTemporalField(Instant $test, TemporalField $field, $value, $expected, $expectedEx) { if ($expectedEx === null) { $result = $test->with($field, $value); $this->assertEquals($result, $expected); } else { try { $result = $test->with($field, $value); $this->fail(); } catch (\Exception $ex) { $this->assertInstanceOf($expectedEx, $ex); } } }