update project
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Architecture;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use SplFileInfo;
|
||||
|
||||
final class SchoolCoreArchitectureTest extends TestCase
|
||||
{
|
||||
public function test_school_core_does_not_use_hidden_context_sources(): void
|
||||
{
|
||||
$forbidden = ['auth(', 'request(', 'Configuration::getConfig(', 'App\\Domain\\IslamicSundaySchool'];
|
||||
$root = app_path('Domain/SchoolCore');
|
||||
|
||||
if (! is_dir($root)) {
|
||||
$this->markTestSkipped('SchoolCore directory not present in this test installation.');
|
||||
}
|
||||
|
||||
$violations = [];
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root)) as $file) {
|
||||
if (! $file instanceof SplFileInfo || $file->getExtension() !== 'php') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$contents = file_get_contents($file->getPathname()) ?: '';
|
||||
foreach ($forbidden as $needle) {
|
||||
if (str_contains($contents, $needle)) {
|
||||
$violations[] = $file->getPathname() . ' contains ' . $needle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertSame([], $violations);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user