Skip to content

Commit

Permalink
[OptionsResolve] Revert change in tests for a not-merged change in code
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Oct 28, 2019
1 parent 6d5c91b commit 15f0855
Showing 1 changed file with 9 additions and 16 deletions.
Expand Up @@ -776,7 +776,7 @@ public function testFailIfSetAllowedTypesFromLazyOption()
public function testResolveFailsIfInvalidTypedArray()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "DateTime".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "DateTime[]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[]');

Expand All @@ -796,10 +796,9 @@ public function testResolveFailsWithNonArray()
public function testResolveFailsIfTypedArrayContainsInvalidTypes()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "stdClass|array|DateTime".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[]", but one of the elements is of type "stdClass[]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[]');

$values = range(1, 5);
$values[] = new \stdClass();
$values[] = [];
Expand All @@ -812,7 +811,7 @@ public function testResolveFailsIfTypedArrayContainsInvalidTypes()
public function testResolveFailsWithCorrectLevelsButWrongScalar()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "double".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "double[][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[][]');

Expand Down Expand Up @@ -848,11 +847,6 @@ public function provideInvalidTypes()
[42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "integer".'],
[null, 'string', 'The option "option" with value null is expected to be of type "string", but is of type "NULL".'],
['bar', '\stdClass', 'The option "option" with value "bar" is expected to be of type "\stdClass", but is of type "string".'],
[['foo', 12], 'string[]', 'The option "option" with value array is expected to be of type "string[]", but one of the elements is of type "integer".'],
[123, ['string[]', 'string'], 'The option "option" with value 123 is expected to be of type "string[]" or "string", but is of type "integer".'],
[[null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "NULL".'],
[['string', null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "NULL".'],
[[\stdClass::class], ['string'], 'The option "option" with value array is expected to be of type "string", but is of type "array".'],
];
}

Expand Down Expand Up @@ -901,7 +895,6 @@ public function testResolveSucceedsIfTypedArray()
new \DateTime(),
],
];

$result = $this->resolver->resolve($data);
$this->assertEquals($data, $result);
}
Expand Down Expand Up @@ -1905,7 +1898,7 @@ public function testNested2Arrays()
public function testNestedArraysException()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer[][][][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'float[][][][]');

Expand All @@ -1923,7 +1916,7 @@ public function testNestedArraysException()
public function testNestedArrayException1()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean|string|array".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[][]');
$this->resolver->resolve([
Expand All @@ -1936,7 +1929,7 @@ public function testNestedArrayException1()
public function testNestedArrayException2()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean|string|array".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean[][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[][]');
$this->resolver->resolve([
Expand All @@ -1949,7 +1942,7 @@ public function testNestedArrayException2()
public function testNestedArrayException3()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string|integer".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string[][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'string[][][]');
$this->resolver->resolve([
Expand All @@ -1962,7 +1955,7 @@ public function testNestedArrayException3()
public function testNestedArrayException4()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer[][][]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'string[][][]');
$this->resolver->resolve([
Expand All @@ -1976,7 +1969,7 @@ public function testNestedArrayException4()
public function testNestedArrayException5()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[]", but one of the elements is of type "array".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[]", but one of the elements is of type "array[]".');
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'string[]');
$this->resolver->resolve([
Expand Down

0 comments on commit 15f0855

Please sign in to comment.