Skip to content

Commit 9ed2e92

Browse files
committed
Use $this->assert* instead of self::assert* in tests
1 parent 18b6dd1 commit 9ed2e92

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/agent/tests/ChatTest.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public function itInitiatesChatByClearingAndSavingMessages(): void
4848
{
4949
$messages = $this->createMock(MessageBagInterface::class);
5050

51-
$this->store->expects(self::once())
51+
$this->store->expects($this->once())
5252
->method('clear');
5353

54-
$this->store->expects(self::once())
54+
$this->store->expects($this->once())
5555
->method('save')
5656
->with($messages);
5757

@@ -67,22 +67,22 @@ public function itSubmitsUserMessageAndReturnsAssistantMessage(): void
6767

6868
$textResult = new TextResult($assistantContent);
6969

70-
$this->store->expects(self::once())
70+
$this->store->expects($this->once())
7171
->method('load')
7272
->willReturn($existingMessages);
7373

74-
$this->agent->expects(self::once())
74+
$this->agent->expects($this->once())
7575
->method('call')
76-
->with(self::callback(function (MessageBagInterface $messages) use ($userMessage) {
76+
->with($this->callback(function (MessageBagInterface $messages) use ($userMessage) {
7777
$messagesArray = $messages->getMessages();
7878

7979
return end($messagesArray) === $userMessage;
8080
}))
8181
->willReturn($textResult);
8282

83-
$this->store->expects(self::once())
83+
$this->store->expects($this->once())
8484
->method('save')
85-
->with(self::callback(function (MessageBagInterface $messages) use ($userMessage, $assistantContent) {
85+
->with($this->callback(function (MessageBagInterface $messages) use ($userMessage, $assistantContent) {
8686
$messagesArray = $messages->getMessages();
8787
$lastTwo = \array_slice($messagesArray, -2);
8888

@@ -94,8 +94,8 @@ public function itSubmitsUserMessageAndReturnsAssistantMessage(): void
9494

9595
$result = $this->chat->submit($userMessage);
9696

97-
self::assertInstanceOf(AssistantMessage::class, $result);
98-
self::assertSame($assistantContent, $result->content);
97+
$this->assertInstanceOf(AssistantMessage::class, $result);
98+
$this->assertSame($assistantContent, $result->content);
9999
}
100100

101101
#[Test]
@@ -113,31 +113,31 @@ public function itAppendsMessagesToExistingConversation(): void
113113

114114
$textResult = new TextResult($newAssistantContent);
115115

116-
$this->store->expects(self::once())
116+
$this->store->expects($this->once())
117117
->method('load')
118118
->willReturn($existingMessages);
119119

120-
$this->agent->expects(self::once())
120+
$this->agent->expects($this->once())
121121
->method('call')
122-
->with(self::callback(function (MessageBagInterface $messages) {
122+
->with($this->callback(function (MessageBagInterface $messages) {
123123
$messagesArray = $messages->getMessages();
124124

125125
return 3 === \count($messagesArray);
126126
}))
127127
->willReturn($textResult);
128128

129-
$this->store->expects(self::once())
129+
$this->store->expects($this->once())
130130
->method('save')
131-
->with(self::callback(function (MessageBagInterface $messages) {
131+
->with($this->callback(function (MessageBagInterface $messages) {
132132
$messagesArray = $messages->getMessages();
133133

134134
return 4 === \count($messagesArray);
135135
}));
136136

137137
$result = $this->chat->submit($newUserMessage);
138138

139-
self::assertInstanceOf(AssistantMessage::class, $result);
140-
self::assertSame($newAssistantContent, $result->content);
139+
$this->assertInstanceOf(AssistantMessage::class, $result);
140+
$this->assertSame($newAssistantContent, $result->content);
141141
}
142142

143143
#[Test]
@@ -149,25 +149,25 @@ public function itHandlesEmptyMessageStore(): void
149149

150150
$textResult = new TextResult($assistantContent);
151151

152-
$this->store->expects(self::once())
152+
$this->store->expects($this->once())
153153
->method('load')
154154
->willReturn($emptyMessages);
155155

156-
$this->agent->expects(self::once())
156+
$this->agent->expects($this->once())
157157
->method('call')
158-
->with(self::callback(function (MessageBagInterface $messages) {
158+
->with($this->callback(function (MessageBagInterface $messages) {
159159
$messagesArray = $messages->getMessages();
160160

161161
return 1 === \count($messagesArray);
162162
}))
163163
->willReturn($textResult);
164164

165-
$this->store->expects(self::once())
165+
$this->store->expects($this->once())
166166
->method('save');
167167

168168
$result = $this->chat->submit($userMessage);
169169

170-
self::assertInstanceOf(AssistantMessage::class, $result);
171-
self::assertSame($assistantContent, $result->content);
170+
$this->assertInstanceOf(AssistantMessage::class, $result);
171+
$this->assertSame($assistantContent, $result->content);
172172
}
173173
}

0 commit comments

Comments
 (0)