42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class Phase7ReportingArchitectureTest extends TestCase
|
|
{
|
|
private function files(string $path): array
|
|
{
|
|
$base = dirname(__DIR__, 2).'/app/'.$path;
|
|
return glob($base.'/**/*.php') ?: [];
|
|
}
|
|
|
|
public function test_school_core_reporting_does_not_depend_on_islamic_sunday_school(): void
|
|
{
|
|
foreach ($this->files('Domain/SchoolCore/Reporting') as $file) {
|
|
$contents = file_get_contents($file);
|
|
$this->assertStringNotContainsString('App\\Domain\\IslamicSundaySchool', $contents, $file);
|
|
}
|
|
}
|
|
|
|
public function test_reporting_domain_does_not_use_request_or_auth_helpers(): void
|
|
{
|
|
foreach ($this->files('Domain/SchoolCore/Reporting') as $file) {
|
|
$contents = file_get_contents($file);
|
|
$this->assertStringNotContainsString('Illuminate\\Http\\Request', $contents, $file);
|
|
$this->assertStringNotContainsString('auth()', $contents, $file);
|
|
$this->assertStringNotContainsString('request()', $contents, $file);
|
|
}
|
|
}
|
|
|
|
public function test_core_reporting_contracts_do_not_contain_extension_vocabulary(): void
|
|
{
|
|
$forbidden = ['quran', 'halaqa', 'masjid', 'ministry'];
|
|
foreach ($this->files('Domain/SchoolCore/Reporting/Contracts') as $file) {
|
|
$contents = strtolower(file_get_contents($file));
|
|
foreach ($forbidden as $term) {
|
|
$this->assertStringNotContainsString($term, $contents, $file);
|
|
}
|
|
}
|
|
}
|
|
}
|