|
12 | 12 | namespace Symfony\Component\TypeInfo\Tests; |
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\TestCase; |
| 15 | +use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait; |
15 | 16 | use Symfony\Component\TypeInfo\Tests\Fixtures\DummyBackedEnum; |
16 | 17 | use Symfony\Component\TypeInfo\Tests\Fixtures\DummyEnum; |
17 | 18 | use Symfony\Component\TypeInfo\Type; |
|
29 | 30 |
|
30 | 31 | class TypeFactoryTest extends TestCase |
31 | 32 | { |
| 33 | + use ExpectUserDeprecationMessageTrait; |
| 34 | + |
32 | 35 | public function testCreateBuiltin() |
33 | 36 | { |
34 | 37 | $this->assertEquals(new BuiltinType(TypeIdentifier::INT), Type::builtin(TypeIdentifier::INT)); |
@@ -136,15 +139,6 @@ public function testCreateIterable() |
136 | 139 | )), |
137 | 140 | Type::iterable(Type::bool(), Type::string()), |
138 | 141 | ); |
139 | | - |
140 | | - $this->assertEquals( |
141 | | - new CollectionType(new GenericType( |
142 | | - new BuiltinType(TypeIdentifier::ITERABLE), |
143 | | - new BuiltinType(TypeIdentifier::INT), |
144 | | - new BuiltinType(TypeIdentifier::BOOL), |
145 | | - ), isList: true), |
146 | | - Type::iterable(Type::bool(), Type::int(), true), |
147 | | - ); |
148 | 142 | } |
149 | 143 |
|
150 | 144 | public function testCreateObject() |
@@ -206,4 +200,13 @@ public function testCreateNullable() |
206 | 200 | Type::nullable(Type::union(Type::int(), Type::string(), Type::null())), |
207 | 201 | ); |
208 | 202 | } |
| 203 | + |
| 204 | + /** |
| 205 | + * @group legacy |
| 206 | + */ |
| 207 | + public function testCannotCreateIterableList() |
| 208 | + { |
| 209 | + $this->expectUserDeprecationMessage('Since symfony/type-info 7.3: "$asList" argument is deprecated, it will always be considered as "false" in 8.0.'); |
| 210 | + Type::iterable(key: Type::int(), asList: true); |
| 211 | + } |
209 | 212 | } |
0 commit comments