Skip to content

Commit 1a1a98d

Browse files
committed
Use ::class constants instead of string class names in AiBundleTest
- Import Definition, Handoff, and MultiAgent classes - Replace string class names with ::class constants - Remove fully qualified class names in assertions
1 parent dcf076a commit 1a1a98d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/ai-bundle/tests/DependencyInjection/AiBundleTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use Symfony\AI\Agent\AgentInterface;
1919
use Symfony\AI\Agent\Memory\MemoryInputProcessor;
2020
use Symfony\AI\Agent\Memory\StaticMemoryProvider;
21+
use Symfony\AI\Agent\MultiAgent\Handoff;
22+
use Symfony\AI\Agent\MultiAgent\MultiAgent;
2123
use Symfony\AI\AiBundle\AiBundle;
2224
use Symfony\AI\Store\Document\Filter\TextContainsFilter;
2325
use Symfony\AI\Store\Document\Loader\InMemoryLoader;
@@ -27,6 +29,7 @@
2729
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
2830
use Symfony\Component\DependencyInjection\ContainerBuilder;
2931
use Symfony\Component\DependencyInjection\ContainerInterface;
32+
use Symfony\Component\DependencyInjection\Definition;
3033
use Symfony\Component\DependencyInjection\Reference;
3134
use Symfony\Component\Translation\TranslatableMessage;
3235

@@ -2129,7 +2132,7 @@ public function testValidMultiAgentConfiguration()
21292132
$multiAgentDefinition = $container->getDefinition('ai.multi_agent.support');
21302133

21312134
// Verify the class is correct
2132-
$this->assertSame('Symfony\AI\Agent\MultiAgent\MultiAgent', $multiAgentDefinition->getClass());
2135+
$this->assertSame(MultiAgent::class, $multiAgentDefinition->getClass());
21332136

21342137
// Verify arguments
21352138
$arguments = $multiAgentDefinition->getArguments();
@@ -2146,8 +2149,8 @@ public function testValidMultiAgentConfiguration()
21462149

21472150
// Verify handoff structure
21482151
$handoff = $handoffs[0];
2149-
$this->assertInstanceOf(\Symfony\Component\DependencyInjection\Definition::class, $handoff);
2150-
$this->assertSame('Symfony\AI\Agent\MultiAgent\Handoff', $handoff->getClass());
2152+
$this->assertInstanceOf(Definition::class, $handoff);
2153+
$this->assertSame(Handoff::class, $handoff->getClass());
21512154
$handoffArgs = $handoff->getArguments();
21522155
$this->assertCount(2, $handoffArgs);
21532156
$this->assertInstanceOf(Reference::class, $handoffArgs[0]);
@@ -2223,8 +2226,8 @@ public function testMultiAgentWithMultipleHandoffs()
22232226

22242227
// Both handoffs should be Definition objects
22252228
foreach ($handoffs as $handoff) {
2226-
$this->assertInstanceOf(\Symfony\Component\DependencyInjection\Definition::class, $handoff);
2227-
$this->assertSame('Symfony\AI\Agent\MultiAgent\Handoff', $handoff->getClass());
2229+
$this->assertInstanceOf(Definition::class, $handoff);
2230+
$this->assertSame(Handoff::class, $handoff->getClass());
22282231
$handoffArgs = $handoff->getArguments();
22292232
$this->assertCount(2, $handoffArgs);
22302233
$this->assertInstanceOf(Reference::class, $handoffArgs[0]);
@@ -2507,7 +2510,7 @@ public function testComprehensiveMultiAgentHappyPath()
25072510

25082511
// Test customer_support multi-agent configuration
25092512
$customerSupportDef = $container->getDefinition('ai.multi_agent.customer_support');
2510-
$this->assertSame('Symfony\AI\Agent\MultiAgent\MultiAgent', $customerSupportDef->getClass());
2513+
$this->assertSame(MultiAgent::class, $customerSupportDef->getClass());
25112514

25122515
$csArguments = $customerSupportDef->getArguments();
25132516
$this->assertCount(4, $csArguments);
@@ -2523,14 +2526,14 @@ public function testComprehensiveMultiAgentHappyPath()
25232526

25242527
// Code expert handoff
25252528
$codeHandoff = $csHandoffs[0];
2526-
$this->assertInstanceOf(\Symfony\Component\DependencyInjection\Definition::class, $codeHandoff);
2529+
$this->assertInstanceOf(Definition::class, $codeHandoff);
25272530
$codeHandoffArgs = $codeHandoff->getArguments();
25282531
$this->assertSame('ai.agent.code_expert', (string) $codeHandoffArgs[0]);
25292532
$this->assertSame(['bug', 'error', 'code', 'debug', 'performance', 'optimization'], $codeHandoffArgs[1]);
25302533

25312534
// Docs expert handoff
25322535
$docsHandoff = $csHandoffs[1];
2533-
$this->assertInstanceOf(\Symfony\Component\DependencyInjection\Definition::class, $docsHandoff);
2536+
$this->assertInstanceOf(Definition::class, $docsHandoff);
25342537
$docsHandoffArgs = $docsHandoff->getArguments();
25352538
$this->assertSame('ai.agent.docs_expert', (string) $docsHandoffArgs[0]);
25362539
$this->assertSame(['documentation', 'docs', 'readme', 'api', 'guide', 'tutorial'], $docsHandoffArgs[1]);

0 commit comments

Comments
 (0)