27 lines
655 B
PHP
27 lines
655 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace MintyPHP\Tests\Architecture;
|
||
|
|
|
||
|
|
trait ProjectFileAssertionSupport
|
||
|
|
{
|
||
|
|
private function projectRootPath(): string
|
||
|
|
{
|
||
|
|
$root = realpath(__DIR__ . '/../..');
|
||
|
|
$this->assertNotFalse($root, 'Project root not found.');
|
||
|
|
|
||
|
|
return $root;
|
||
|
|
}
|
||
|
|
|
||
|
|
private function readProjectFile(string $path): string
|
||
|
|
{
|
||
|
|
$root = $this->projectRootPath();
|
||
|
|
$fullPath = $root . '/' . $path;
|
||
|
|
$this->assertFileExists($fullPath, 'File not found: ' . $path);
|
||
|
|
|
||
|
|
$content = file_get_contents($fullPath);
|
||
|
|
$this->assertNotFalse($content, 'Could not read file: ' . $path);
|
||
|
|
|
||
|
|
return $content;
|
||
|
|
}
|
||
|
|
}
|