ldc-arcadia-api/tests/Architecture/CodingStandardsTest.php

57 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
describe('Coding Standards & Project Rules', function (): void {
arch()->preset()->php();
// assert(bool) est intentionnel pour le type narrowing PHPStan, seul assert(string) est dangereux (deprecated PHP 8.3)
arch()->preset()->security()->ignoring('assert');
arch('config() helper is not used in src (use Config facade instead)')
->expect('config')
->not->toBeUsed();
arch('env() helper is not used in src (use Config facade instead)')
->expect('env')
->not->toBeUsed();
arch('debug functions are not used in src')
->expect(['dd', 'dump', 'var_dump', 'die', 'print_r', 'ray'])
->not->toBeUsed();
arch('shell execution functions are not used in src')
->expect(['exec', 'shell_exec', 'system', 'passthru', 'proc_open'])
->not->toBeUsed();
arch('eval function is not used in src')
->expect('eval')
->not->toBeUsed();
arch('insecure hashing functions are not used in src')
->expect(['md5', 'sha1'])
->not->toBeUsed();
arch('sleep functions are not used in src')
->expect(['sleep', 'usleep'])
->not->toBeUsed();
arch('all Domain source files use strict types')
->expect('Domain')
->toUseStrictTypes();
arch('all Application source files use strict types')
->expect('Application')
->toUseStrictTypes();
arch('all Presentation source files use strict types')
->expect('Presentation')
->toUseStrictTypes();
arch('all Infra source files use strict types')
->expect('Infra')
->toUseStrictTypes();
arch('all Shared source files use strict types')
->expect('Shared')
->toUseStrictTypes();
});