Add ScandalousTest

This commit is contained in:
2026-06-06 10:23:16 +02:00
parent ebf977cf48
commit 0eb94ccf55
5 changed files with 1955 additions and 3 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.devenv/
vendor/
.php-cs-fixer.cache
.phpunit.result.cache

View File

@@ -14,6 +14,8 @@
},
"require-dev": {
"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

File diff suppressed because it is too large Load Diff

16
phpunit.xml Normal file
View 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
View 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);
}
}