Skip to content

Commit

Permalink
Replace Annotations with Attributes in Unit Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedghanem00 committed May 8, 2024
1 parent c69c64d commit fb3c070
Showing 1 changed file with 2 additions and 39 deletions.
41 changes: 2 additions & 39 deletions tests/Unit/TesseractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,15 @@
use Exception;
use Intervention\Image\Exception\NotReadableException;
use Intervention\Image\ImageManager;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Smalot\PdfParser\Parser;
use stdClass;
use Symfony\Component\Process\Exception\ProcessTimedOutException;

/**
*
*/
#[CoversClass(Tesseract::class)]
class TesseractTest extends TestCase
{
/**
* @covers Tesseract::getVersion
* @return void
*/
public function testGetVersion(): void
{
$tesseract = new Tesseract();
Expand All @@ -45,10 +40,6 @@ public function testGetVersion(): void
$this->assertStringContainsString("tesseract ", $version); # Not very good assertion but it just a temp for now
}

/**
* @covers Tesseract::getVersion
* @return void
*/
public function testGetVersionWithInvalidBinaryPath(): void
{
$tesseract = new Tesseract("/not/exist/path");
Expand All @@ -58,21 +49,13 @@ public function testGetVersionWithInvalidBinaryPath(): void
$tesseract->getVersion();
}

/**
* @covers Tesseract::getSupportedLanguages
* @return void
*/
public function testGetSupportedLanguages(): void
{
$tesseract = new Tesseract();

$this->assertIsArray($tesseract->getSupportedLanguages());
}

/**
* @covers Tesseract::getSupportedLanguages
* @return void
*/
public function testGetSupportedLanguagesWithWrongTessDataPath(): void
{
$tesseract = new Tesseract();
Expand All @@ -88,8 +71,6 @@ public function testGetSupportedLanguagesWithWrongTessDataPath(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognize(): void
Expand All @@ -103,8 +84,6 @@ public function testRecognize(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithWrongTessDataPath(): void
Expand All @@ -118,8 +97,6 @@ public function testRecognizeWithWrongTessDataPath(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithMisConfiguredDPI(): void
Expand All @@ -134,8 +111,6 @@ public function testRecognizeWithMisConfiguredDPI(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithInvalidConfig(): void
Expand All @@ -149,8 +124,6 @@ public function testRecognizeWithInvalidConfig(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithTimeout(): void
Expand All @@ -164,8 +137,6 @@ public function testRecognizeWithTimeout(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithOnlineImage(): void
Expand All @@ -178,8 +149,6 @@ public function testRecognizeWithOnlineImage(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithOutputAsPDF(): void
Expand All @@ -193,8 +162,6 @@ public function testRecognizeWithOutputAsPDF(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithEmptyGDImage(): void
Expand All @@ -210,8 +177,6 @@ public function testRecognizeWithEmptyGDImage(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithEmptyImagickImage(): void
Expand All @@ -227,8 +192,6 @@ public function testRecognizeWithEmptyImagickImage(): void
}

/**
* @covers Tesseract::recognize
* @return void
* @throws Exception
*/
public function testRecognizeWithInvalidImageSource(): void
Expand Down

0 comments on commit fb3c070

Please sign in to comment.