-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphparkitect.php
30 lines (23 loc) · 1007 Bytes
/
phparkitect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
declare(strict_types=1);
use Arkitect\ClassSet;
use Arkitect\CLI\Config;
use Arkitect\Expression\ForClasses\Extend;
use Arkitect\Expression\ForClasses\HaveNameMatching;
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces;
use Arkitect\Rules\Rule;
use PHPUnit\Framework\TestCase;
return static function (Config $config): void {
$srcClassSet = ClassSet::fromDir(__DIR__ . '/src');
$commandNamingRule = Rule::allClasses()
->that(new ResideInOneOfTheseNamespaces('MyOnlineStore\DevTools\Command'))
->should(new HaveNameMatching('*Command'))
->because('we want uniform naming for console commands');
$config->add($srcClassSet, $commandNamingRule);
$testClassSet = ClassSet::fromDir(__DIR__ . '/tests');
$testNamingRule = Rule::allClasses()
->that(new Extend(TestCase::class))
->should(new HaveNameMatching('*Test'))
->because('that is a PHPUnit naming convention');
$config->add($testClassSet, $testNamingRule);
};