ldc-boutique-cnc-sable/tests/Architecture/CodingStandardsTest.php

53 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2026-06-14 21:32:07 +02:00
<?php
declare(strict_types=1);
describe('coding standards', function (): void {
arch()->preset()->php();
arch()->preset()->security();
arch('it has no shell execution functions are used')
->expect(['exec', 'shell_exec', 'system', 'passthru', 'proc_open'])
->not->toBeUsed();
arch('it has no eval usage')
->expect(['eval'])
->not->toBeUsed();
arch('it has no dangerous file functions')
->expect(['file_get_contents', 'file_put_contents', 'fopen'])
->not->toBeUsed();
arch('it has no globals are used')
->expect(['$GLOBALS', 'global'])
->not->toBeUsed();
arch('it has no singletons')
->expect(['getInstance', 'instance'])
->not->toBeUsed();
arch('it has no insecure hashing')
->expect(['md5', 'sha1'])
->not->toBeUsed();
arch('it has no sleep function are used')
->expect(['sleep', 'usleep'])
->not->toBeUsed();
arch('it has no debug globals are used')
->expect(['var_dump', 'die', 'print_r'])
->not->toBeUsed();
arch('all app source files use strict types')
->expect('App')
->toUseStrictTypes();
arch('all domain source files use strict types')
->expect('Domain')
->toUseStrictTypes();
arch('all shared source files use strict types')
->expect('Shared')
->toUseStrictTypes();
});