Skip to content

Commit 38f6561

Browse files
committed
remove exception message check
1 parent dfec5bc commit 38f6561

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

src/Symfony/Component/Console/Tests/Command/InvokableCommandTest.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
class InvokableCommandTest extends TestCase
2929
{
30-
private const FUNCTION_NAME = 'Symfony\Component\Console\Tests\Command\InvokableCommandTest::Symfony\Component\Console\Tests\Command\{closure}()';
31-
3230
public function testCommandInputArgumentDefinition()
3331
{
3432
$command = new Command('foo');
@@ -140,7 +138,6 @@ public function testInvalidArgumentType()
140138
$command->setCode(function (#[Argument] object $any) {});
141139

142140
$this->expectException(LogicException::class);
143-
$this->expectExceptionMessage(\sprintf('The type "object" on parameter "$any" of "%s" is not supported as a command argument. Only "string", "bool", "int", "float", "array" types are allowed.', self::FUNCTION_NAME));
144141

145142
$command->getDefinition();
146143
}
@@ -151,7 +148,6 @@ public function testInvalidOptionType()
151148
$command->setCode(function (#[Option] ?object $any = null) {});
152149

153150
$this->expectException(LogicException::class);
154-
$this->expectExceptionMessage(\sprintf('The type "object" on parameter "$any" of "%s" is not supported as a command option. Only "string", "bool", "int", "float", "array" types are allowed.', self::FUNCTION_NAME));
155151

156152
$command->getDefinition();
157153
}
@@ -324,54 +320,44 @@ public static function provideNonBinaryInputOptions(): \Generator
324320
/**
325321
* @dataProvider provideInvalidOptionDefinitions
326322
*/
327-
public function testInvalidOptionDefinition(callable $code, string $expectedMessage)
323+
public function testInvalidOptionDefinition(callable $code)
328324
{
329325
$command = new Command('foo');
330326
$command->setCode($code);
331327

332328
$this->expectException(LogicException::class);
333-
$this->expectExceptionMessage($expectedMessage);
334329

335330
$command->getDefinition();
336331
}
337332

338333
public static function provideInvalidOptionDefinitions(): \Generator
339334
{
340335
yield 'no-default' => [
341-
function (#[Option] string $a) {},
342-
\sprintf('The option parameter "$a" of "%s" must declare a default value.', self::FUNCTION_NAME),
336+
function (#[Option] string $a) {}
343337
];
344338
yield 'nullable-bool-default-true' => [
345-
function (#[Option] ?bool $a = true) {},
346-
\sprintf('The option parameter "$a" of "%s" must not be nullable when it has a default boolean value.', self::FUNCTION_NAME),
339+
function (#[Option] ?bool $a = true) {}
347340
];
348341
yield 'nullable-bool-default-false' => [
349-
function (#[Option] ?bool $a = false) {},
350-
\sprintf('The option parameter "$a" of "%s" must not be nullable when it has a default boolean value.', self::FUNCTION_NAME),
342+
function (#[Option] ?bool $a = false) {}
351343
];
352344
yield 'invalid-union-type' => [
353-
function (#[Option] array|bool $a = false) {},
354-
\sprintf('The union type for parameter "$a" of "%s" is not supported as a command option. Only "bool|string", "bool|int", "bool|float" types are allowed.', self::FUNCTION_NAME),
345+
function (#[Option] array|bool $a = false) {}
355346
];
356347
yield 'union-type-cannot-allow-null' => [
357348
function (#[Option] string|bool|null $a = null) {},
358-
\sprintf('The union type for parameter "$a" of "%s" is not supported as a command option. Only "bool|string", "bool|int", "bool|float" types are allowed.', self::FUNCTION_NAME),
359349
];
360350
yield 'union-type-default-true' => [
361351
function (#[Option] string|bool $a = true) {},
362-
\sprintf('The option parameter "$a" of "%s" must have a default value of false.', self::FUNCTION_NAME),
363352
];
364353
yield 'union-type-default-string' => [
365354
function (#[Option] string|bool $a = 'foo') {},
366-
\sprintf('The option parameter "$a" of "%s" must have a default value of false.', self::FUNCTION_NAME),
367355
];
368356
yield 'nullable-string-not-null-default' => [
369357
function (#[Option] ?string $a = 'foo') {},
370-
\sprintf('The option parameter "$a" of "%s" must either be not-nullable or have a default of null.', self::FUNCTION_NAME),
371358
];
372359
yield 'nullable-array-not-null-default' => [
373360
function (#[Option] ?array $a = []) {},
374-
\sprintf('The option parameter "$a" of "%s" must either be not-nullable or have a default of null.', self::FUNCTION_NAME),
375361
];
376362
}
377363

0 commit comments

Comments
 (0)