Skip to content

Commit c70f628

Browse files
committed
Apply PHP CS Fixer
1 parent cbffcf0 commit c70f628

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

src/agent/tests/Toolbox/Tool/SimilaritySearchTest.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function searchWithResults(): void
3535
{
3636
$searchTerm = 'find similar documents';
3737
$vector = new Vector([0.1, 0.2, 0.3]);
38-
38+
3939
$document1 = new VectorDocument(
4040
Uuid::v4(),
4141
$vector,
@@ -46,112 +46,112 @@ public function searchWithResults(): void
4646
$vector,
4747
new Metadata(['title' => 'Document 2', 'content' => 'Second document content']),
4848
);
49-
49+
5050
$rawResult = $this->createMock(RawResultInterface::class);
5151
$vectorResult = new VectorResult($vector);
5252
$resultPromise = new ResultPromise(
53-
fn() => $vectorResult,
53+
fn () => $vectorResult,
5454
$rawResult
5555
);
56-
56+
5757
$platform = $this->createMock(PlatformInterface::class);
5858
$platform->expects($this->once())
5959
->method('invoke')
6060
->with($this->isInstanceOf(Model::class), $searchTerm)
6161
->willReturn($resultPromise);
62-
62+
6363
$vectorStore = $this->createMock(VectorStoreInterface::class);
6464
$vectorStore->expects($this->once())
6565
->method('query')
6666
->with($vector)
6767
->willReturn([$document1, $document2]);
68-
68+
6969
$model = new Model('test-model');
7070
$similaritySearch = new SimilaritySearch($platform, $model, $vectorStore);
71-
71+
7272
$result = $similaritySearch($searchTerm);
73-
73+
7474
$expected = 'Found documents with following information:'.PHP_EOL;
7575
$expected .= '{"title":"Document 1","content":"First document content"}';
7676
$expected .= '{"title":"Document 2","content":"Second document content"}';
77-
77+
7878
$this->assertSame($expected, $result);
7979
$this->assertSame([$document1, $document2], $similaritySearch->usedDocuments);
8080
}
81-
81+
8282
#[Test]
8383
public function searchWithoutResults(): void
8484
{
8585
$searchTerm = 'find nothing';
8686
$vector = new Vector([0.1, 0.2, 0.3]);
87-
87+
8888
$rawResult = $this->createMock(RawResultInterface::class);
8989
$vectorResult = new VectorResult($vector);
9090
$resultPromise = new ResultPromise(
91-
fn() => $vectorResult,
91+
fn () => $vectorResult,
9292
$rawResult
9393
);
94-
94+
9595
$platform = $this->createMock(PlatformInterface::class);
9696
$platform->expects($this->once())
9797
->method('invoke')
9898
->with($this->isInstanceOf(Model::class), $searchTerm)
9999
->willReturn($resultPromise);
100-
100+
101101
$vectorStore = $this->createMock(VectorStoreInterface::class);
102102
$vectorStore->expects($this->once())
103103
->method('query')
104104
->with($vector)
105105
->willReturn([]);
106-
106+
107107
$model = new Model('test-model');
108108
$similaritySearch = new SimilaritySearch($platform, $model, $vectorStore);
109-
109+
110110
$result = $similaritySearch($searchTerm);
111-
111+
112112
$this->assertSame('No results found', $result);
113113
$this->assertSame([], $similaritySearch->usedDocuments);
114114
}
115-
115+
116116
#[Test]
117117
public function searchWithSingleResult(): void
118118
{
119119
$searchTerm = 'specific query';
120120
$vector = new Vector([0.5, 0.6, 0.7]);
121-
121+
122122
$document = new VectorDocument(
123123
Uuid::v4(),
124124
$vector,
125125
new Metadata(['title' => 'Single Document', 'description' => 'Only one match']),
126126
);
127-
127+
128128
$rawResult = $this->createMock(RawResultInterface::class);
129129
$vectorResult = new VectorResult($vector);
130130
$resultPromise = new ResultPromise(
131-
fn() => $vectorResult,
131+
fn () => $vectorResult,
132132
$rawResult
133133
);
134-
134+
135135
$platform = $this->createMock(PlatformInterface::class);
136136
$platform->expects($this->once())
137137
->method('invoke')
138138
->with($this->isInstanceOf(Model::class), $searchTerm)
139139
->willReturn($resultPromise);
140-
140+
141141
$vectorStore = $this->createMock(VectorStoreInterface::class);
142142
$vectorStore->expects($this->once())
143143
->method('query')
144144
->with($vector)
145145
->willReturn([$document]);
146-
146+
147147
$model = new Model('test-model');
148148
$similaritySearch = new SimilaritySearch($platform, $model, $vectorStore);
149-
149+
150150
$result = $similaritySearch($searchTerm);
151-
151+
152152
$expected = 'Found documents with following information:'.PHP_EOL;
153153
$expected .= '{"title":"Single Document","description":"Only one match"}';
154-
154+
155155
$this->assertSame($expected, $result);
156156
$this->assertSame([$document], $similaritySearch->usedDocuments);
157157
}

src/agent/tests/Toolbox/Tool/YouTubeTranscriberTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,35 @@ public function constructorSucceedsWhenPackageIsInstalled(): void
2727
if (!class_exists(TranscriptListFetcher::class)) {
2828
$this->markTestSkipped('mrmysql/youtube-transcript package is not installed');
2929
}
30-
30+
3131
$httpClient = new MockHttpClient();
32-
32+
3333
// Constructor should not throw when package is installed
3434
$transcriber = new YouTubeTranscriber($httpClient);
35-
35+
3636
$this->assertInstanceOf(YouTubeTranscriber::class, $transcriber);
3737
}
38-
38+
3939
#[Test]
4040
public function constructorChecksForRequiredPackage(): void
4141
{
4242
// This test verifies that the constructor has the proper check for the required package.
4343
// Since we can't actually uninstall the package during testing, we'll verify the
4444
// behavior by checking that the class exists check is in the constructor.
45-
45+
4646
$reflection = new \ReflectionClass(YouTubeTranscriber::class);
4747
$constructor = $reflection->getConstructor();
4848
$this->assertNotNull($constructor);
49-
49+
5050
// Get the constructor source code to verify it checks for the package
5151
$filename = $reflection->getFileName();
5252
$start_line = $constructor->getStartLine();
5353
$end_line = $constructor->getEndLine();
5454
$length = $end_line - $start_line + 1;
55-
55+
5656
$source = file($filename);
5757
$constructorBody = implode('', array_slice($source, $start_line - 1, $length));
58-
58+
5959
// Verify the constructor checks for the TranscriptListFetcher class
6060
$this->assertStringContainsString('class_exists(TranscriptListFetcher::class)', $constructorBody);
6161
$this->assertStringContainsString('LogicException', $constructorBody);

0 commit comments

Comments
 (0)