Skip to content

[DependencyInjection] fix tests #53742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parameters:
unit_enum: !php/enum Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAR
enum_array: [!php/enum Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAR, !php/enum Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::FOO]
unit_enum: !php/const Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAR
enum_array: [!php/const Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAR, !php/const Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::FOO]

services:
service_container:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ services:
Symfony\Component\DependencyInjection\Tests\Fixtures\FooClassWithEnumAttribute:
class: Symfony\Component\DependencyInjection\Tests\Fixtures\FooClassWithEnumAttribute
public: true
arguments: [!php/const 'Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAR']
arguments: [!php/enum 'Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAR']
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype;
use Symfony\Component\ExpressionLanguage\Expression;
use Symfony\Component\Yaml\Yaml;

class YamlFileLoaderTest extends TestCase
{
Expand Down Expand Up @@ -1020,7 +1021,13 @@ public function testInvalidEnumeration()
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The enum "Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAZ" is not defined');

if (str_starts_with(Yaml::dump(FooUnitEnum::BAR), '!php/enum')) {
$this->expectExceptionMessage('The string "Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAZ" is not the name of a valid enum');
} else {
$this->expectExceptionMessage('The enum "Symfony\Component\DependencyInjection\Tests\Fixtures\FooUnitEnum::BAZ" is not defined');
}

$loader->load('services_with_invalid_enumeration.yml');
}

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/DependencyInjection/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"symfony/var-exporter": "^6.4|^7.0"
},
"require-dev": {
"symfony/yaml": "^7.1",
"symfony/yaml": "^6.4|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/expression-language": "^6.4|^7.0"
},
"conflict": {
"ext-psr": "<1.1|>=2",
"symfony/config": "<6.4",
"symfony/finder": "<6.4",
"symfony/yaml": "<7.1"
"symfony/yaml": "<6.4"
},
"provide": {
"psr/container-implementation": "1.1|2.0",
Expand Down