$this->metadata =
new ClassMetadata(self::TEST_CLASS
);
$this->metadataFactory =
new FakeMetadataFactory();
$this->metadataFactory->
addMetadata($this->metadata
);
$this->guesser =
new ValidatorTypeGuesser($this->metadataFactory
);
} /**
* @dataProvider guessTypeProvider
*/
public function testGuessType(Constraint
$constraint, TypeGuess
$guess) { $this->metadata->
addPropertyConstraint(self::TEST_PROPERTY,
$constraint);
$this->
assertEquals($guess,
$this->guesser->
guessType(self::TEST_CLASS, self::TEST_PROPERTY
));
} public static function guessTypeProvider() { return [ [new Type('array'
),
new TypeGuess(CollectionType::
class,
[], Guess::MEDIUM_CONFIDENCE
)],
[new Type('bool'
),
new TypeGuess(CheckboxType::
class,
[], Guess::MEDIUM_CONFIDENCE
)],
[new Type('boolean'
),
new TypeGuess(CheckboxType::
class,
[], Guess::MEDIUM_CONFIDENCE
)],
[new Type('double'
),
new TypeGuess(NumberType::
class,
[], Guess::MEDIUM_CONFIDENCE
)],
[