Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
Update Pdf2TxtClientTest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
joanfabregat committed Dec 6, 2024
1 parent 17296be commit 4703c52
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/Pdf2TxtClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

namespace CodeInc\Pdf2TxtClient\Tests;

use CodeInc\Office2PdfClient\Office2PdfClient;
use CodeInc\Pdf2TxtClient\ConvertOptions;
use CodeInc\Pdf2TxtClient\Exception;
use CodeInc\Pdf2TxtClient\Format;
use CodeInc\Pdf2TxtClient\Pdf2TxtClient;
use JsonException;
use PHPUnit\Framework\TestCase;
use Psr\Http\Client\ClientExceptionInterface;
use Psr\Http\Message\StreamInterface;

/**
Expand All @@ -31,6 +33,21 @@ final class Pdf2TxtClientTest extends TestCase
private const string TEST_PDF_RESULT_TXT = __DIR__.'/assets/file.txt';
private const string TEST_PDF_RESULT_JSON = __DIR__.'/assets/file.json';

public function testHealth(): void
{
// testing a healthy service
$client = $this->getNewClient();
$this->assertNotFalse($client->checkServiceHealth(), "The service is not healthy.");

// testing a non-existing service
$client = new Pdf2TxtClient('https://example.com');
$this->assertFalse($client->checkServiceHealth(), "The service is healthy.");

// testing a non-existing url
$client = new Pdf2TxtClient('https://example-NQrkB6F6MwuXesMrBhqx.com');
$this->assertFalse($client->checkServiceHealth(), "The service is healthy.");
}

/**
* @throws Exception
*/
Expand Down

0 comments on commit 4703c52

Please sign in to comment.