/** * @test * @dataProvider provideValues */ public function it_constructs_new_instance_correctly($possibleValue, $shouldBeNull) { $valOrNull = IntegerOrNull::fromNativeValue($possibleValue); $this->assertInstanceOf('Prooph\\Processing\\Type\\IntegerOrNull', $valOrNull); $this->assertEquals($possibleValue, $valOrNull->value()); $asString = $valOrNull->toString(); $fromString = IntegerOrNull::fromString($asString); $this->assertTrue($valOrNull->sameAs($fromString)); $asJson = json_encode($valOrNull); $fromJson = IntegerOrNull::fromJsonDecodedData(json_decode($asJson)); $this->assertTrue($valOrNull->sameAs($fromJson)); $this->assertSame($shouldBeNull, $valOrNull->isNull()); }