Skip to content

Commit 7c7071a

Browse files
committed
Introduce getters and metadata to message classes
1 parent 6d92fc3 commit 7c7071a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/Blog/ChatTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function testLoadMessagesReturnsDefaultSystemMessage()
3737

3838
$systemMessage = $messages->getMessages()[0];
3939
$this->assertInstanceOf(SystemMessage::class, $systemMessage);
40-
$this->assertStringContainsString('helpful assistant', $systemMessage->content);
41-
$this->assertStringContainsString('similarity_search', $systemMessage->content);
40+
$this->assertStringContainsString('helpful assistant', $systemMessage->getContent());
41+
$this->assertStringContainsString('similarity_search', $systemMessage->getContent());
4242
}
4343

4444
public function testSubmitMessageAddsUserMessageAndAgentResponse()
@@ -65,12 +65,12 @@ public function testSubmitMessageAddsUserMessageAndAgentResponse()
6565
// Check user message
6666
$userMessage = $messageList[1];
6767
$this->assertInstanceOf(UserMessage::class, $userMessage);
68-
$this->assertSame('What is Symfony?', $userMessage->content[0]->text);
68+
$this->assertSame('What is Symfony?', $userMessage->getContent()[0]->getText());
6969

7070
// Check assistant message
7171
$assistantMessage = $messageList[2];
7272
$this->assertInstanceOf(AssistantMessage::class, $assistantMessage);
73-
$this->assertSame('Symfony is a PHP web framework for building web applications and APIs.', $assistantMessage->content);
73+
$this->assertSame('Symfony is a PHP web framework for building web applications and APIs.', $assistantMessage->getContent());
7474
}
7575

7676
public function testSubmitMessageWithUnknownQueryUsesDefaultResponse()
@@ -91,7 +91,7 @@ public function testSubmitMessageWithUnknownQueryUsesDefaultResponse()
9191

9292
// Check assistant used default response
9393
$assistantMessage = $messageList[2];
94-
$this->assertSame('I can help you with Symfony-related questions!', $assistantMessage->content);
94+
$this->assertSame('I can help you with Symfony-related questions!', $assistantMessage->getContent());
9595
}
9696

9797
public function testMultipleMessagesAreTrackedCorrectly()
@@ -169,10 +169,10 @@ public function testAgentReceivesFullConversationHistory()
169169
$this->assertCount(5, $messages);
170170

171171
// Verify the conversation flow (with 5 messages)
172-
$this->assertStringContainsString('helpful assistant', $messages[0]->content); // system
173-
$this->assertSame('What is Symfony?', $messages[1]->content[0]->text); // user1
174-
$this->assertSame('Symfony is a PHP web framework for building web applications and APIs.', $messages[2]->content); // assistant1
175-
$this->assertSame('Tell me more', $messages[3]->content[0]->text); // user2
172+
$this->assertStringContainsString('helpful assistant', $messages[0]->getContent()); // system
173+
$this->assertSame('What is Symfony?', $messages[1]->getContent()[0]->getText()); // user1
174+
$this->assertSame('Symfony is a PHP web framework for building web applications and APIs.', $messages[2]->getContent()); // assistant1
175+
$this->assertSame('Tell me more', $messages[3]->getContent()[0]->getText()); // user2
176176
// The 5th message appears to be the previous assistant response or another system message
177177
}
178178

0 commit comments

Comments
 (0)