Skip to content
Merged
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
2 changes: 1 addition & 1 deletion tests/esrequest_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public function tearDown(): void {
* The GuzzleHttp exception is no longer be throwed
*/
public function test_get_unreachable_host(): void {
$this->expectException(\GuzzleHttp\Exception\ConnectException::class);
$url = 'http://unreachable:9020';
$client = new \search_elastic\esrequest();
$response = $client->get($url);
$this->assertEquals(503, $response->getStatusCode());
}

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/local/chunking/fixed_size_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public static function chunk_overlap_provider(): array {
* @dataProvider chunk_overlap_provider
* @param int $maxsize
* @param int $overlap
* @param int $exceptednumchunks
* @param int $expectednumchunks
*/
public function test_chunk_with_overlap(int $maxsize, int $overlap, int $exceptednumchunks): void {
public function test_chunk_with_overlap(int $maxsize, int $overlap, int $expectednumchunks): void {
$rec = new stdClass();
$rec->content = <<<EOF
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Expand All @@ -128,11 +128,12 @@ public function test_chunk_with_overlap(int $maxsize, int $overlap, int $excepte
$options = [
'maxsize' => $maxsize,
'overlap' => $overlap,
'expectednumchunks' => $expectednumchunks,
];

$chunkingstrategy = new fixed_size();
$chunks = $chunkingstrategy->chunk($docdata['content'], $options);
$this->assertCount($exceptednumchunks, $chunks);
$this->assertCount($expectednumchunks, $chunks);

// Last chunk should include end of text.
$lastchunk = $chunks[count($chunks) - 1]['text'];
Expand Down
6 changes: 3 additions & 3 deletions tests/server_ready_check_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public static function server_ready_provider(): array {
* Tests check result.
*
* @param string $hostname
* @param string $expectedstatus
* @param string $status
* @dataProvider server_ready_provider
*/
public function test_check(string $hostname, string $expectedstatus): void {
public function test_check(string $hostname, string $status): void {
$this->resetAfterTest();
set_config('hostname', $hostname, 'search_elastic');

Expand All @@ -86,7 +86,7 @@ public function test_check(string $hostname, string $expectedstatus): void {

$check = new server_ready_check($stack);
$result = $check->get_result();
$this->assertEquals($expectedstatus, $result->get_status());
$this->assertEquals($status, $result->get_status());
}

/**
Expand Down
Loading