Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
'header_comment' => [
'header' => implode('', $fileHeaderParts),
],
'php_unit_test_annotation' => [
'style' => 'annotation',
],
'php_unit_attributes' => true,
])
->setRiskyAllowed(true)
->setFinder(
Expand Down
12 changes: 6 additions & 6 deletions src/agent/tests/Toolbox/MetadataFactory/ChainFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function setUp(): void
}

#[Test]
public function testGetMetadataNotExistingClass(): void
public function getMetadataNotExistingClass(): void
Copy link
Member

@nicolas-grekas nicolas-grekas Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's strange to me, it blurs the line between test cases and helper methods
we should also consider making the practices on symfony/symfony and symfoyn/ai converge
this looks diverging here to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Having a void method with a get name prefix feels espcially weird.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is mostly about (not) having the test* prefix in the method name, not about the void, right?

i don't have a real preference other than being more used to having the prefix over the attribute, but mostly care about streamlining here :)

@OskarStark any hard feelings about going the symfony/symfony way here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is mostly about (not) having the test* prefix in the method name

Yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the new method names are confusing.
I don't think using the Test attribute makes things better.

{
self::expectException(ToolException::class);
self::expectExceptionMessage('The reference "NoClass" is not a valid tool.');
Expand All @@ -56,7 +56,7 @@ public function testGetMetadataNotExistingClass(): void
}

#[Test]
public function testGetMetadataNotConfiguredClass(): void
public function getMetadataNotConfiguredClass(): void
{
self::expectException(ToolConfigurationException::class);
self::expectExceptionMessage(\sprintf('Method "foo" not found in tool "%s".', ToolMisconfigured::class));
Expand All @@ -65,15 +65,15 @@ public function testGetMetadataNotConfiguredClass(): void
}

#[Test]
public function testGetMetadataWithAttributeSingleHit(): void
public function getMetadataWithAttributeSingleHit(): void
{
$metadata = iterator_to_array($this->factory->getTool(ToolRequiredParams::class));

self::assertCount(1, $metadata);
}

#[Test]
public function testGetMetadataOverwrite(): void
public function getMetadataOverwrite(): void
{
$metadata = iterator_to_array($this->factory->getTool(ToolOptionalParam::class));

Expand All @@ -84,15 +84,15 @@ public function testGetMetadataOverwrite(): void
}

#[Test]
public function testGetMetadataWithAttributeDoubleHit(): void
public function getMetadataWithAttributeDoubleHit(): void
{
$metadata = iterator_to_array($this->factory->getTool(ToolMultiple::class));

self::assertCount(2, $metadata);
}

#[Test]
public function testGetMetadataWithMemorySingleHit(): void
public function getMetadataWithMemorySingleHit(): void
{
$metadata = iterator_to_array($this->factory->getTool(ToolNoAttribute1::class));

Expand Down
2 changes: 1 addition & 1 deletion src/agent/tests/Toolbox/ToolResultConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class ToolResultConverterTest extends TestCase
{
#[Test]
#[DataProvider('provideResults')]
public function testConvert(mixed $result, ?string $expected): void
public function convert(mixed $result, ?string $expected): void
{
$converter = new ToolResultConverter();

Expand Down
2 changes: 1 addition & 1 deletion src/platform/tests/Bridge/Bedrock/Nova/ContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class ContractTest extends TestCase
{
#[Test]
#[DataProvider('provideMessageBag')]
public function testConvert(MessageBag $bag, array $expected): void
public function convert(MessageBag $bag, array $expected): void
{
$contract = Contract::create(
new AssistantMessageNormalizer(),
Expand Down