Skip to content

Commit 4e6e9fa

Browse files
Merge branch '6.4' into 7.0
* 6.4: [HttpClient][Mailer] Revert "Let curl handle transfer encoding", use HTTP/1.1 for Mailgun Reviewed Catalan missing translations [AssetMapper] Upgrade importmap polyfill Fix typo: synchronous -> synchronously [Serializer] Check if exception message in test is correct Ibexa is sponsoring Symfony 5.4, thanks to them! \o/ [VarDumper] Fix `FFICaster` test to be platform-adaptable [String] Add `alias` case to `EnglishInflector` [FrameworkBundle] Throw runtime exception when trying to use asset-mapper while http-client is disabled [SecurityBundle] Remove unused memory users’ `name` attribute from the XSD [VarExporter] generate __doUnserialize() method in ProxyHelper::generateLazyProxy() Double check if pcntl function exists Add additional headers in Scaleway bridge [VarDumper] Fix FFI caster test [DependencyInjection] Add test coverage for `AutowireCallable::buildDefinition()`
2 parents 45d2bb5 + a4df9df commit 4e6e9fa

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Tests/Attribute/AutowireCallableTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,35 @@ public function testArrayCallableWithServiceOnly()
9393
self::assertEquals([new Reference('my_service'), '__invoke'], $attribute->value);
9494
self::assertFalse($attribute->lazy);
9595
}
96+
97+
public function testLazyAsArrayInDefinition()
98+
{
99+
$attribute = new AutowireCallable(callable: [Foo::class, 'myMethod'], lazy: 'my_lazy_class');
100+
101+
self::assertSame([Foo::class, 'myMethod'], $attribute->value);
102+
103+
$definition = $attribute->buildDefinition('my_value', 'my_custom_type', new \ReflectionParameter([Foo::class, 'myMethod'], 'myParameter'));
104+
105+
self::assertSame('my_lazy_class', $definition->getClass());
106+
self::assertTrue($definition->isLazy());
107+
}
108+
109+
public function testLazyIsFalseInDefinition()
110+
{
111+
$attribute = new AutowireCallable(callable: [Foo::class, 'myMethod'], lazy: false);
112+
113+
self::assertFalse($attribute->lazy);
114+
115+
$definition = $attribute->buildDefinition('my_value', 'my_custom_type', new \ReflectionParameter([Foo::class, 'myMethod'], 'myParameter'));
116+
117+
self::assertSame('my_custom_type', $definition->getClass());
118+
self::assertFalse($definition->isLazy());
119+
}
120+
}
121+
122+
class Foo
123+
{
124+
public function myMethod(callable $myParameter)
125+
{
126+
}
96127
}

0 commit comments

Comments
 (0)