createMock(AbstractPlatform::class); $type = Type::getType(RutType::NAME); $result = $type->convertToPHPValue(null, $platform); self::assertNull($result); } public function testItConvertsStringFromDatabaseValue(): void { $platform = $this->createMock(AbstractPlatform::class); $type = Type::getType(RutType::NAME); $result = $type->convertToPHPValue('16.894.365-2', $platform); self::assertInstanceOf(Rut::class, $result); } public function testItCannotConvertFromDatabaseValue(): void { $platform = $this->createMock(AbstractPlatform::class); $type = Type::getType(RutType::NAME); $this->expectException(ConversionException::class); $type->convertToPHPValue(true, $platform); } public function testItConvertsNullToDatabaseValue(): void { $platform = $this->createMock(AbstractPlatform::class); $type = Type::getType(RutType::NAME); $result = $type->convertToDatabaseValue(null, $platform); self::assertNull($result); } public function testItConvertsRutToDatabaseValue(): void { $platform = $this->createMock(AbstractPlatform::class); $type = Type::getType(RutType::NAME); $result = $type->convertToDatabaseValue(Rut::parse('168943652'), $platform); self::assertSame('16.894.365-2', $result); } public function testItCannotConvertToDatabaseValue(): void { $platform = $this->createMock(AbstractPlatform::class); $type = Type::getType(RutType::NAME); $this->expectException(ConversionException::class); $type->convertToDatabaseValue(new \DateTime(), $platform); } }