[OptionsResolve] Revert change in tests for a not-merged change in code
This commit is contained in:
parent
6d5c91bb47
commit
15f08553be
@ -776,7 +776,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testResolveFailsIfInvalidTypedArray()
|
public function testResolveFailsIfInvalidTypedArray()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'int[]');
|
$this->resolver->setAllowedTypes('foo', 'int[]');
|
||||||
|
|
||||||
@ -796,10 +796,9 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testResolveFailsIfTypedArrayContainsInvalidTypes()
|
public function testResolveFailsIfTypedArrayContainsInvalidTypes()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'int[]');
|
$this->resolver->setAllowedTypes('foo', 'int[]');
|
||||||
|
|
||||||
$values = range(1, 5);
|
$values = range(1, 5);
|
||||||
$values[] = new \stdClass();
|
$values[] = new \stdClass();
|
||||||
$values[] = [];
|
$values[] = [];
|
||||||
@ -812,7 +811,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testResolveFailsWithCorrectLevelsButWrongScalar()
|
public function testResolveFailsWithCorrectLevelsButWrongScalar()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'int[][]');
|
$this->resolver->setAllowedTypes('foo', 'int[][]');
|
||||||
|
|
||||||
@ -848,11 +847,6 @@ class OptionsResolverTest extends TestCase
|
|||||||
[42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "integer".'],
|
[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".'],
|
[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".'],
|
['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".'],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,7 +895,6 @@ class OptionsResolverTest extends TestCase
|
|||||||
new \DateTime(),
|
new \DateTime(),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$result = $this->resolver->resolve($data);
|
$result = $this->resolver->resolve($data);
|
||||||
$this->assertEquals($data, $result);
|
$this->assertEquals($data, $result);
|
||||||
}
|
}
|
||||||
@ -1905,7 +1898,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testNestedArraysException()
|
public function testNestedArraysException()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'float[][][][]');
|
$this->resolver->setAllowedTypes('foo', 'float[][][][]');
|
||||||
|
|
||||||
@ -1923,7 +1916,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testNestedArrayException1()
|
public function testNestedArrayException1()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'int[][]');
|
$this->resolver->setAllowedTypes('foo', 'int[][]');
|
||||||
$this->resolver->resolve([
|
$this->resolver->resolve([
|
||||||
@ -1936,7 +1929,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testNestedArrayException2()
|
public function testNestedArrayException2()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'int[][]');
|
$this->resolver->setAllowedTypes('foo', 'int[][]');
|
||||||
$this->resolver->resolve([
|
$this->resolver->resolve([
|
||||||
@ -1949,7 +1942,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testNestedArrayException3()
|
public function testNestedArrayException3()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'string[][][]');
|
$this->resolver->setAllowedTypes('foo', 'string[][][]');
|
||||||
$this->resolver->resolve([
|
$this->resolver->resolve([
|
||||||
@ -1962,7 +1955,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testNestedArrayException4()
|
public function testNestedArrayException4()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'string[][][]');
|
$this->resolver->setAllowedTypes('foo', 'string[][][]');
|
||||||
$this->resolver->resolve([
|
$this->resolver->resolve([
|
||||||
@ -1976,7 +1969,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testNestedArrayException5()
|
public function testNestedArrayException5()
|
||||||
{
|
{
|
||||||
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
|
$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->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'string[]');
|
$this->resolver->setAllowedTypes('foo', 'string[]');
|
||||||
$this->resolver->resolve([
|
$this->resolver->resolve([
|
||||||
|
Reference in New Issue
Block a user