Add ScandalousTest
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
.devenv/
|
.devenv/
|
||||||
vendor/
|
vendor/
|
||||||
.php-cs-fixer.cache
|
.php-cs-fixer.cache
|
||||||
|
.phpunit.result.cache
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "^3.95",
|
"friendsofphp/php-cs-fixer": "^3.95",
|
||||||
"phpstan/phpstan": "^2.2"
|
"phpstan/phpstan": "^2.2",
|
||||||
|
"phpunit/phpunit": "^13.1",
|
||||||
|
"mockery/mockery": "^1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1907
composer.lock
generated
1907
composer.lock
generated
File diff suppressed because it is too large
Load Diff
16
phpunit.xml
Normal file
16
phpunit.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
colors="true">
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Tests">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory>src</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
|
</phpunit>
|
||||||
28
tests/ScandalousTest.php
Normal file
28
tests/ScandalousTest.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Scandalous\Tests;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Scandalous\Scandalous;
|
||||||
|
use Scandalous\Contract\ProcessRunnerInterface;
|
||||||
|
use Scandalous\Engine\LiteParseExtractor;
|
||||||
|
|
||||||
|
final class ScandalousTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testExtractWithMockProcessRunner(): void
|
||||||
|
{
|
||||||
|
$mockRunner = $this->createMock(ProcessRunnerInterface::class);
|
||||||
|
$mockRunner
|
||||||
|
->expects($this->once())
|
||||||
|
->method('run')
|
||||||
|
->willReturn('Mock extracted text content');
|
||||||
|
|
||||||
|
$extractor = new LiteParseExtractor($mockRunner);
|
||||||
|
$scandalous = new Scandalous($extractor);
|
||||||
|
|
||||||
|
$result = $scandalous->extract('path/to/pdffile.pdf');
|
||||||
|
$this->assertSame('Mock extracted text content', $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user