diff --git a/context.yaml b/context.yaml index fcb57a3d..fc2af6f9 100644 --- a/context.yaml +++ b/context.yaml @@ -26,44 +26,9 @@ documents: - '*Interface.php' showTreeView: true - - description: Project Templates - outputPath: core/templates.md - sources: - - type: file - sourcePaths: - - src/Template - - vendor/spiral/files/src/FilesInterface.php - showTreeView: true - - - description: Research Templates - outputPath: core/drafling.md - sources: - - type: file - sourcePaths: - - src/Research/Config - - src/Research/Domain - - src/Research/Repository - - src/Research/Service - - src/Research/Storage/StorageDriverInterface.php - - - description: Research FileStorage - outputPath: drafling/file-storage.md - sources: - - type: file - sourcePaths: - - src/Research/Storage - - - description: Research MCP - outputPath: drafling/mcp.md - sources: - - type: file - sourcePaths: - - src/Research/MCP - - src/McpServer/McpServerBootloader.php - - - description: "Changes in the Project" outputPath: "changes.md" sources: - type: git_diff commit: unstaged + diff --git a/src/Config/Import/ImportResolver.php b/src/Config/Import/ImportResolver.php index 046769d7..cdd4a003 100644 --- a/src/Config/Import/ImportResolver.php +++ b/src/Config/Import/ImportResolver.php @@ -9,8 +9,8 @@ use Butschster\ContextGenerator\Config\Import\Merger\ConfigMergerProviderInterface; use Butschster\ContextGenerator\Config\Import\PathPrefixer\DocumentOutputPathPrefixer; use Butschster\ContextGenerator\Config\Import\PathPrefixer\SourcePathPrefixer; -use Butschster\ContextGenerator\Config\Import\Source\Config\SourceConfigInterface; use Butschster\ContextGenerator\Config\Import\Source\Config\SourceConfigFactory; +use Butschster\ContextGenerator\Config\Import\Source\Config\SourceConfigInterface; use Butschster\ContextGenerator\Config\Import\Source\Exception\ImportSourceException; use Butschster\ContextGenerator\Config\Import\Source\ImportedConfig; use Butschster\ContextGenerator\Config\Import\Source\ImportSourceProvider; @@ -31,8 +31,8 @@ public function __construct( private ImportSourceProvider $sourceProvider, private WildcardPathFinder $pathFinder, private ConfigMergerProviderInterface $configMergerProvider, - private DocumentOutputPathPrefixer $documentPrefixer = new DocumentOutputPathPrefixer(), - private SourcePathPrefixer $sourcePrefixer = new SourcePathPrefixer(), + private DocumentOutputPathPrefixer $documentPrefixer, + private SourcePathPrefixer $sourcePrefixer, private SourceConfigFactory $sourceConfigFactory = new SourceConfigFactory(), private CircularImportDetectorInterface $detector = new CircularImportDetector(), #[LoggerPrefix(prefix: 'import-resolver')] diff --git a/src/Config/Import/PathPrefixer/PathPrefixer.php b/src/Config/Import/PathPrefixer/PathPrefixer.php index e709ab4e..ff84a558 100644 --- a/src/Config/Import/PathPrefixer/PathPrefixer.php +++ b/src/Config/Import/PathPrefixer/PathPrefixer.php @@ -4,11 +4,17 @@ namespace Butschster\ContextGenerator\Config\Import\PathPrefixer; +use Butschster\ContextGenerator\Lib\Variable\VariableResolver; + /** * Abstract base class for path prefix operations */ abstract readonly class PathPrefixer { + public function __construct( + protected VariableResolver $variables, + ) {} + /** * Apply a path prefix to the appropriate paths in a configuration */ @@ -20,6 +26,7 @@ abstract public function applyPrefix(array $config, string $pathPrefix): array; protected function combinePaths(string $prefix, string $path): string { $combined = \rtrim($prefix, '/') . '/' . \ltrim($path, '/'); + return $this->normalizePath($combined); } diff --git a/src/Config/Import/PathPrefixer/SourcePathPrefixer.php b/src/Config/Import/PathPrefixer/SourcePathPrefixer.php index 102ef3e9..48b01ce3 100644 --- a/src/Config/Import/PathPrefixer/SourcePathPrefixer.php +++ b/src/Config/Import/PathPrefixer/SourcePathPrefixer.php @@ -58,10 +58,13 @@ private function applyPathPrefixToSource(array $source, string $prefix): array private function applyPrefixToPaths(mixed $paths, string $prefix): mixed { if (\is_string($paths)) { + $paths = $this->variables->resolve($paths); + // Skip absolute paths if ($this->isAbsolutePath($paths)) { return $paths; } + return $this->combinePaths($prefix, $paths); } diff --git a/src/Lib/Variable/Provider/PredefinedVariableProvider.php b/src/Lib/Variable/Provider/PredefinedVariableProvider.php index 89f1110a..83d732b0 100644 --- a/src/Lib/Variable/Provider/PredefinedVariableProvider.php +++ b/src/Lib/Variable/Provider/PredefinedVariableProvider.php @@ -4,11 +4,17 @@ namespace Butschster\ContextGenerator\Lib\Variable\Provider; +use Butschster\ContextGenerator\DirectoriesInterface; + /** * Provider with predefined system variables */ final readonly class PredefinedVariableProvider implements VariableProviderInterface { + public function __construct( + private DirectoriesInterface $dirs, + ) {} + public function has(string $name): bool { return \array_key_exists($name, $this->getPredefinedVariables()); @@ -37,6 +43,11 @@ private function getPredefinedVariables(): array 'OS' => PHP_OS, 'HOSTNAME' => \gethostname() ?: 'unknown', 'PWD' => \getcwd() ?: '.', + + 'ROOT_PATH' => (string) $this->dirs->getRootPath(), + 'CONFIG_PATH' => (string) $this->dirs->getConfigPath(), + 'ENV_PATH' => (string) $this->dirs->getEnvFilePath(), + 'BINARY_PATH' => (string) $this->dirs->getBinaryPath(), ]; } } diff --git a/src/Lib/Variable/VariableBootloader.php b/src/Lib/Variable/VariableBootloader.php index 2e7bf429..cbd129e5 100644 --- a/src/Lib/Variable/VariableBootloader.php +++ b/src/Lib/Variable/VariableBootloader.php @@ -49,7 +49,7 @@ public function defineSingletons(): array ), // Predefined system variables have lowest priority - new PredefinedVariableProvider(), + new PredefinedVariableProvider(dirs: $dirs), ); }, diff --git a/src/Lib/Variable/VariableReplacementProcessor.php b/src/Lib/Variable/VariableReplacementProcessor.php index 9ae44144..f709a413 100644 --- a/src/Lib/Variable/VariableReplacementProcessor.php +++ b/src/Lib/Variable/VariableReplacementProcessor.php @@ -5,9 +5,9 @@ namespace Butschster\ContextGenerator\Lib\Variable; use Butschster\ContextGenerator\Application\Logger\LoggerPrefix; -use Butschster\ContextGenerator\Lib\Variable\Provider\PredefinedVariableProvider; use Butschster\ContextGenerator\Lib\Variable\Provider\VariableProviderInterface; use Psr\Log\LoggerInterface; +use Spiral\Core\Attribute\Proxy; /** * Processor that replaces variable references in text @@ -15,7 +15,8 @@ final readonly class VariableReplacementProcessor implements VariableReplacementProcessorInterface { public function __construct( - private VariableProviderInterface $provider = new PredefinedVariableProvider(), + #[Proxy] + private VariableProviderInterface $provider, #[LoggerPrefix(prefix: 'variable-replacement')] private ?LoggerInterface $logger = null, ) {} diff --git a/tests/src/Feature/Console/GenerateCommand/CompilingResult.php b/tests/src/Feature/Console/GenerateCommand/CompilingResult.php index 1a289285..27d72928 100644 --- a/tests/src/Feature/Console/GenerateCommand/CompilingResult.php +++ b/tests/src/Feature/Console/GenerateCommand/CompilingResult.php @@ -4,7 +4,7 @@ namespace Tests\Feature\Console\GenerateCommand; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; /** * Wrapper for generate command result assertions diff --git a/tests/src/Feature/Console/GenerateCommand/ToolAssertions.php b/tests/src/Feature/Console/GenerateCommand/ToolAssertions.php index b67cdd98..accccd48 100644 --- a/tests/src/Feature/Console/GenerateCommand/ToolAssertions.php +++ b/tests/src/Feature/Console/GenerateCommand/ToolAssertions.php @@ -4,7 +4,7 @@ namespace Tests\Feature\Console\GenerateCommand; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; /** * Trait providing tool assertion methods for CompilingResult diff --git a/tests/src/Feature/Research/Storage/FileStorage/DirectoryScannerTest.php b/tests/src/Feature/Research/Storage/FileStorage/DirectoryScannerTest.php index 142678e5..cb270d4f 100644 --- a/tests/src/Feature/Research/Storage/FileStorage/DirectoryScannerTest.php +++ b/tests/src/Feature/Research/Storage/FileStorage/DirectoryScannerTest.php @@ -6,7 +6,7 @@ use Butschster\ContextGenerator\Research\Storage\FileStorage\DirectoryScanner; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; use Spiral\Exceptions\ExceptionReporterInterface; use Spiral\Files\Files; @@ -245,6 +245,7 @@ public function report(\Throwable $exception): void $this->scanner = new DirectoryScanner($files, $reporter); } + #[\Override] protected function tearDown(): void { // Clean up temp directory diff --git a/tests/src/Feature/Research/Storage/FileStorage/FrontmatterParserTest.php b/tests/src/Feature/Research/Storage/FileStorage/FrontmatterParserTest.php index 302ec235..f61eb876 100644 --- a/tests/src/Feature/Research/Storage/FileStorage/FrontmatterParserTest.php +++ b/tests/src/Feature/Research/Storage/FileStorage/FrontmatterParserTest.php @@ -6,7 +6,7 @@ use Butschster\ContextGenerator\Research\Storage\FileStorage\FrontmatterParser; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; final class FrontmatterParserTest extends TestCase { diff --git a/tests/src/TestCase.php b/tests/src/TestCase.php index d25bab59..152653b1 100644 --- a/tests/src/TestCase.php +++ b/tests/src/TestCase.php @@ -5,6 +5,7 @@ namespace Tests; use Butschster\ContextGenerator\Directories; +use Butschster\ContextGenerator\DirectoriesInterface; use PHPUnit\Framework\TestCase as BaseTestCase; /** @@ -26,6 +27,11 @@ abstract class TestCase extends BaseTestCase */ private array $tempDirs = []; + public function getDirs(): DirectoriesInterface + { + return $this->createDirectories(); + } + /** * Clean up temporary files and directories */ diff --git a/tests/src/Unit/Application/FSPathLinuxTest.php b/tests/src/Unit/Application/FSPathLinuxTest.php index 4eb46b75..8c6b5459 100644 --- a/tests/src/Unit/Application/FSPathLinuxTest.php +++ b/tests/src/Unit/Application/FSPathLinuxTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(FSPath::class)] final class FSPathLinuxTest extends TestCase @@ -265,6 +265,7 @@ protected function setUp(): void } } + #[\Override] protected function tearDown(): void { // Reset directory separator if it was overridden diff --git a/tests/src/Unit/Application/FSPathMixedSlashTest.php b/tests/src/Unit/Application/FSPathMixedSlashTest.php index 57a78350..ad8936ab 100644 --- a/tests/src/Unit/Application/FSPathMixedSlashTest.php +++ b/tests/src/Unit/Application/FSPathMixedSlashTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(FSPath::class)] final class FSPathMixedSlashTest extends TestCase @@ -220,6 +220,7 @@ public function it_should_normalize_path_with_many_mixed_slashes(): void $this->assertSame('C:/Users/test/documents/file.txt', $path->toString()); } + #[\Override] protected function tearDown(): void { // Always reset directory separator at the end of each test diff --git a/tests/src/Unit/Application/FSPathWindowsTest.php b/tests/src/Unit/Application/FSPathWindowsTest.php index 973c0dcf..b7fcd69a 100644 --- a/tests/src/Unit/Application/FSPathWindowsTest.php +++ b/tests/src/Unit/Application/FSPathWindowsTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(FSPath::class)] final class FSPathWindowsTest extends TestCase @@ -218,6 +218,7 @@ protected function setUp(): void } } + #[\Override] protected function tearDown(): void { // Reset directory separator if it was overridden diff --git a/tests/src/Unit/Fetcher/FileSourceFetcherTest.php b/tests/src/Unit/Fetcher/FileSourceFetcherTest.php index cace2389..334c30dc 100644 --- a/tests/src/Unit/Fetcher/FileSourceFetcherTest.php +++ b/tests/src/Unit/Fetcher/FileSourceFetcherTest.php @@ -10,7 +10,7 @@ use Butschster\ContextGenerator\Source\File\FileSourceFetcher; use Butschster\ContextGenerator\Source\SourceInterface; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; class FileSourceFetcherTest extends TestCase { diff --git a/tests/src/Unit/Fetcher/FileTreeBuilderTest.php b/tests/src/Unit/Fetcher/FileTreeBuilderTest.php index f18ac6d0..fa99921a 100644 --- a/tests/src/Unit/Fetcher/FileTreeBuilderTest.php +++ b/tests/src/Unit/Fetcher/FileTreeBuilderTest.php @@ -6,7 +6,7 @@ use Butschster\ContextGenerator\Lib\TreeBuilder\FileTreeBuilder; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; class FileTreeBuilderTest extends TestCase { diff --git a/tests/src/Unit/Fetcher/TextSourceFetcherTest.php b/tests/src/Unit/Fetcher/TextSourceFetcherTest.php index 6f3ac149..0df63e00 100644 --- a/tests/src/Unit/Fetcher/TextSourceFetcherTest.php +++ b/tests/src/Unit/Fetcher/TextSourceFetcherTest.php @@ -9,7 +9,7 @@ use Butschster\ContextGenerator\Source\Text\TextSource; use Butschster\ContextGenerator\Source\Text\TextSourceFetcher; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; class TextSourceFetcherTest extends TestCase { diff --git a/tests/src/Unit/Lib/Html/HtmlCleanerTest.php b/tests/src/Unit/Lib/Html/HtmlCleanerTest.php index eeab780f..3caddc52 100644 --- a/tests/src/Unit/Lib/Html/HtmlCleanerTest.php +++ b/tests/src/Unit/Lib/Html/HtmlCleanerTest.php @@ -7,7 +7,7 @@ use Butschster\ContextGenerator\Lib\Html\HtmlCleaner; use League\HTMLToMarkdown\HtmlConverter; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; class HtmlCleanerTest extends TestCase { diff --git a/tests/src/Unit/Lib/TreeBuilder/DirectorySorterTest.php b/tests/src/Unit/Lib/TreeBuilder/DirectorySorterTest.php index 5cd0ed08..956e3f4d 100644 --- a/tests/src/Unit/Lib/TreeBuilder/DirectorySorterTest.php +++ b/tests/src/Unit/Lib/TreeBuilder/DirectorySorterTest.php @@ -7,7 +7,7 @@ use Butschster\ContextGenerator\Lib\TreeBuilder\DirectorySorter; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(DirectorySorter::class)] final class DirectorySorterTest extends TestCase diff --git a/tests/src/Unit/Lib/TreeBuilder/FileTreeBuilderTest.php b/tests/src/Unit/Lib/TreeBuilder/FileTreeBuilderTest.php index f1612393..494ef273 100644 --- a/tests/src/Unit/Lib/TreeBuilder/FileTreeBuilderTest.php +++ b/tests/src/Unit/Lib/TreeBuilder/FileTreeBuilderTest.php @@ -8,7 +8,7 @@ use Butschster\ContextGenerator\Lib\TreeBuilder\TreeRendererInterface; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(FileTreeBuilder::class)] final class FileTreeBuilderTest extends TestCase @@ -261,6 +261,7 @@ protected function setUp(): void \file_put_contents($this->tempDir . '/dir2/subdir/file4.txt', 'content'); } + #[\Override] protected function tearDown(): void { $this->removeDirectory($this->tempDir); diff --git a/tests/src/Unit/Lib/Variable/Provider/CompositeVariableProviderTest.php b/tests/src/Unit/Lib/Variable/Provider/CompositeVariableProviderTest.php index db98a5ac..4c9451fe 100644 --- a/tests/src/Unit/Lib/Variable/Provider/CompositeVariableProviderTest.php +++ b/tests/src/Unit/Lib/Variable/Provider/CompositeVariableProviderTest.php @@ -8,7 +8,7 @@ use Butschster\ContextGenerator\Lib\Variable\Provider\VariableProviderInterface; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(CompositeVariableProvider::class)] class CompositeVariableProviderTest extends TestCase diff --git a/tests/src/Unit/Lib/Variable/Provider/DotEnvVariableProviderTest.php b/tests/src/Unit/Lib/Variable/Provider/DotEnvVariableProviderTest.php index 0168969f..712824d2 100644 --- a/tests/src/Unit/Lib/Variable/Provider/DotEnvVariableProviderTest.php +++ b/tests/src/Unit/Lib/Variable/Provider/DotEnvVariableProviderTest.php @@ -8,7 +8,7 @@ use Dotenv\Repository\RepositoryInterface; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(DotEnvVariableProvider::class)] class DotEnvVariableProviderTest extends TestCase diff --git a/tests/src/Unit/Lib/Variable/Provider/PredefinedVariableProviderTest.php b/tests/src/Unit/Lib/Variable/Provider/PredefinedVariableProviderTest.php index 1e27fb5b..978c2687 100644 --- a/tests/src/Unit/Lib/Variable/Provider/PredefinedVariableProviderTest.php +++ b/tests/src/Unit/Lib/Variable/Provider/PredefinedVariableProviderTest.php @@ -7,7 +7,7 @@ use Butschster\ContextGenerator\Lib\Variable\Provider\PredefinedVariableProvider; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(PredefinedVariableProvider::class)] class PredefinedVariableProviderTest extends TestCase @@ -83,6 +83,6 @@ public function it_should_return_temp_directory(): void protected function setUp(): void { - $this->provider = new PredefinedVariableProvider(); + $this->provider = new PredefinedVariableProvider(dirs: $this->getDirs()); } } diff --git a/tests/src/Unit/Lib/Variable/VariableReplacementProcessorTest.php b/tests/src/Unit/Lib/Variable/VariableReplacementProcessorTest.php index 9fbff69c..3306c885 100644 --- a/tests/src/Unit/Lib/Variable/VariableReplacementProcessorTest.php +++ b/tests/src/Unit/Lib/Variable/VariableReplacementProcessorTest.php @@ -9,7 +9,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; use Psr\Log\LoggerInterface; #[CoversClass(VariableReplacementProcessor::class)] diff --git a/tests/src/Unit/Lib/Variable/VariableResolverTest.php b/tests/src/Unit/Lib/Variable/VariableResolverTest.php index 595a4237..a8f2bad5 100644 --- a/tests/src/Unit/Lib/Variable/VariableResolverTest.php +++ b/tests/src/Unit/Lib/Variable/VariableResolverTest.php @@ -9,7 +9,7 @@ use Butschster\ContextGenerator\Lib\Variable\VariableResolver; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(VariableResolver::class)] class VariableResolverTest extends TestCase diff --git a/tests/src/Unit/Lib/Variable/VariableSystemIntegrationTest.php b/tests/src/Unit/Lib/Variable/VariableSystemIntegrationTest.php index ede91a4e..b8bbf087 100644 --- a/tests/src/Unit/Lib/Variable/VariableSystemIntegrationTest.php +++ b/tests/src/Unit/Lib/Variable/VariableSystemIntegrationTest.php @@ -98,7 +98,7 @@ public function get(string $name): ?string $compositeProvider = new CompositeVariableProvider( $customProviderWithOverride, // Highest priority $this->customProvider, // Middle priority - new PredefinedVariableProvider(), // Lowest priority + new PredefinedVariableProvider(dirs: $this->getDirs()), // Lowest priority ); $processor = new VariableReplacementProcessor($compositeProvider); @@ -180,7 +180,7 @@ public function get(string $name): ?string // Create a composite provider with predefined variables and our custom provider $compositeProvider = new CompositeVariableProvider( - new PredefinedVariableProvider(), // Lower priority (system variables) + new PredefinedVariableProvider(dirs: $this->getDirs()), // Lower priority (system variables) $this->customProvider, // Higher priority (custom variables) ); diff --git a/tests/src/Unit/Source/GitDiff/Fetcher/Source/GitSourceTestCase.php b/tests/src/Unit/Source/GitDiff/Fetcher/Source/GitSourceTestCase.php index 2429fa96..e97f4ef3 100644 --- a/tests/src/Unit/Source/GitDiff/Fetcher/Source/GitSourceTestCase.php +++ b/tests/src/Unit/Source/GitDiff/Fetcher/Source/GitSourceTestCase.php @@ -7,7 +7,7 @@ use Butschster\ContextGenerator\Lib\Git\Command; use Butschster\ContextGenerator\Lib\Git\CommandsExecutorInterface; use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; diff --git a/tests/src/Unit/Source/GitDiff/RenderStrategy/LLMFriendlyRenderStrategyTest.php b/tests/src/Unit/Source/GitDiff/RenderStrategy/LLMFriendlyRenderStrategyTest.php index b3fc86f1..01b6ab87 100644 --- a/tests/src/Unit/Source/GitDiff/RenderStrategy/LLMFriendlyRenderStrategyTest.php +++ b/tests/src/Unit/Source/GitDiff/RenderStrategy/LLMFriendlyRenderStrategyTest.php @@ -10,7 +10,7 @@ use Butschster\ContextGenerator\Source\GitDiff\RenderStrategy\LLMFriendlyRenderStrategy; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(LLMFriendlyRenderStrategy::class)] final class LLMFriendlyRenderStrategyTest extends TestCase diff --git a/tests/src/Unit/Source/GitDiff/RenderStrategy/RawRenderStrategyTest.php b/tests/src/Unit/Source/GitDiff/RenderStrategy/RawRenderStrategyTest.php index 5144456c..d87c138d 100644 --- a/tests/src/Unit/Source/GitDiff/RenderStrategy/RawRenderStrategyTest.php +++ b/tests/src/Unit/Source/GitDiff/RenderStrategy/RawRenderStrategyTest.php @@ -10,7 +10,7 @@ use Butschster\ContextGenerator\Source\GitDiff\RenderStrategy\RawRenderStrategy; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(RawRenderStrategy::class)] final class RawRenderStrategyTest extends TestCase diff --git a/tests/src/Unit/Source/GitDiff/RenderStrategy/RenderStrategyFactoryTest.php b/tests/src/Unit/Source/GitDiff/RenderStrategy/RenderStrategyFactoryTest.php index 1342bdb3..081e4fa6 100644 --- a/tests/src/Unit/Source/GitDiff/RenderStrategy/RenderStrategyFactoryTest.php +++ b/tests/src/Unit/Source/GitDiff/RenderStrategy/RenderStrategyFactoryTest.php @@ -11,7 +11,7 @@ use Butschster\ContextGenerator\Source\GitDiff\RenderStrategy\RenderStrategyInterface; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; -use PHPUnit\Framework\TestCase; +use Tests\TestCase; #[CoversClass(RenderStrategyFactory::class)] final class RenderStrategyFactoryTest extends TestCase diff --git a/tests/src/Unit/Source/Url/UrlSourceFetcherTest.php b/tests/src/Unit/Source/Url/UrlSourceFetcherTest.php index e19afe51..e9401d93 100644 --- a/tests/src/Unit/Source/Url/UrlSourceFetcherTest.php +++ b/tests/src/Unit/Source/Url/UrlSourceFetcherTest.php @@ -9,6 +9,7 @@ use Butschster\ContextGenerator\Lib\Html\SelectorContentExtractorInterface; use Butschster\ContextGenerator\Lib\HttpClient\HttpClientInterface; use Butschster\ContextGenerator\Lib\HttpClient\HttpResponse; +use Butschster\ContextGenerator\Lib\Variable\Provider\PredefinedVariableProvider; use Butschster\ContextGenerator\Lib\Variable\VariableReplacementProcessor; use Butschster\ContextGenerator\Lib\Variable\VariableResolver; use Butschster\ContextGenerator\Modifier\ModifiersApplierInterface; @@ -18,8 +19,8 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; +use Tests\TestCase; #[CoversClass(UrlSourceFetcher::class)] class UrlSourceFetcherTest extends TestCase @@ -316,7 +317,7 @@ protected function setUp(): void { $this->httpClient = $this->createMock(HttpClientInterface::class); $this->variableResolver = new VariableResolver( - new VariableReplacementProcessor(), + new VariableReplacementProcessor(new PredefinedVariableProvider(dirs: $this->getDirs())), ); $this->cleaner = $this->createMock(HtmlCleanerInterface::class); $this->selectorExtractor = $this->createMock(SelectorContentExtractorInterface::class);