Skip to content

Commit a6d83f8

Browse files
author
Emmanuel Campait
committed
chore: prepare 1.0.1 release
improve package quality checks and test coverage
1 parent 8726107 commit a6d83f8

18 files changed

+520
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/vendor/
22
/composer.lock
3+
/build/

.php-cs-fixer.dist.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of domprojects/codeigniter4-breadcrumb.
7+
*
8+
* (c) domProjects
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
use CodeIgniter\CodingStandard\CodeIgniter4;
15+
use Nexus\CsConfig\Factory;
16+
use PhpCsFixer\Finder;
17+
18+
$finder = Finder::create()
19+
->files()
20+
->in([
21+
__DIR__ . '/src/',
22+
__DIR__ . '/tests/',
23+
])
24+
->exclude([
25+
'build',
26+
])
27+
->append([
28+
__FILE__,
29+
__DIR__ . '/rector.php',
30+
]);
31+
32+
$options = [
33+
'finder' => $finder,
34+
'cacheFile' => 'build/.php-cs-fixer.cache',
35+
];
36+
37+
return Factory::create(new CodeIgniter4(), [], $options)->forLibrary(
38+
'domprojects/codeigniter4-breadcrumb',
39+
'domProjects',
40+
);

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# domprojects/codeigniter4-breadcrumb
1+
# Breadcrumb for CodeIgniter 4
22

33
Breadcrumb builder and controller integration for CodeIgniter 4 projects.
44

composer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,36 @@
2626
"php": "^8.2",
2727
"codeigniter4/framework": "^4.7.2"
2828
},
29+
"require-dev": {
30+
"codeigniter4/devkit": "^1.3"
31+
},
2932
"autoload": {
3033
"psr-4": {
3134
"domProjects\\CodeIgniterBreadcrumb\\": "src/"
3235
}
3336
},
37+
"autoload-dev": {
38+
"psr-4": {
39+
"domProjects\\CodeIgniterBreadcrumb\\Tests\\": "tests/"
40+
}
41+
},
42+
"config": {
43+
"allow-plugins": {
44+
"phpstan/extension-installer": true
45+
},
46+
"sort-packages": true
47+
},
48+
"scripts": {
49+
"analyze": [
50+
"Composer\\Config::disableProcessTimeout",
51+
"phpstan analyse -c phpstan.neon.dist",
52+
"psalm --config=psalm.xml",
53+
"rector process --dry-run --config=rector.php"
54+
],
55+
"cs": "php-cs-fixer fix --ansi --verbose --dry-run --diff --config=.php-cs-fixer.dist.php",
56+
"cs-fix": "php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.dist.php",
57+
"test": "phpunit -c phpunit.xml.dist"
58+
},
3459
"extra": {
3560
"branch-alias": {
3661
"dev-main": "1.x-dev"

phpstan.neon.dist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
parameters:
2+
tmpDir: build/phpstan-tmp
3+
level: 6
4+
paths:
5+
- src/
6+
- tests/
7+
bootstrapFiles:
8+
- tests/bootstrap.php
9+
excludePaths:
10+
- tests/_support/*
11+
scanDirectories:
12+
- ../../../vendor/codeigniter4/framework/system/Helpers
13+
universalObjectCratesClasses:
14+
- CodeIgniter\Entity
15+
- CodeIgniter\Entity\Entity
16+
- Faker\Generator
17+
dynamicConstantNames:
18+
- APP_NAMESPACE
19+
- CI_DEBUG
20+
- ENVIRONMENT

phpunit.xml.dist

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
4+
bootstrap="tests/bootstrap.php"
5+
backupGlobals="false"
6+
beStrictAboutOutputDuringTests="true"
7+
colors="true"
8+
executionOrder="random"
9+
failOnRisky="true"
10+
failOnWarning="true"
11+
stopOnError="false"
12+
stopOnFailure="false"
13+
stopOnIncomplete="false"
14+
stopOnSkipped="false"
15+
cacheDirectory="build/.phpunit.cache"
16+
beStrictAboutCoverageMetadata="true">
17+
<coverage includeUncoveredFiles="true">
18+
<report>
19+
<clover outputFile="build/phpunit/clover.xml"/>
20+
<html outputDirectory="build/phpunit/html"/>
21+
<php outputFile="build/phpunit/coverage.serialized"/>
22+
<text outputFile="php://stdout" showUncoveredFiles="false"/>
23+
<xml outputDirectory="build/phpunit/xml-coverage"/>
24+
</report>
25+
</coverage>
26+
<testsuites>
27+
<testsuite name="main">
28+
<directory>./tests</directory>
29+
</testsuite>
30+
</testsuites>
31+
<extensions>
32+
<bootstrap class="Nexus\PHPUnit\Tachycardia\TachycardiaExtension">
33+
<parameter name="time-limit" value="0.50"/>
34+
<parameter name="report-count" value="30"/>
35+
<parameter name="format" value="table"/>
36+
</bootstrap>
37+
</extensions>
38+
<logging>
39+
<testdoxHtml outputFile="build/phpunit/testdox.html"/>
40+
<testdoxText outputFile="build/phpunit/testdox.txt"/>
41+
<junit outputFile="build/phpunit/junit.xml"/>
42+
</logging>
43+
<php>
44+
<env name="XDEBUG_MODE" value="coverage"/>
45+
<env name="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
46+
<server name="app.baseURL" value="https://example.com/"/>
47+
</php>
48+
<source>
49+
<include>
50+
<directory suffix=".php">./src/</directory>
51+
</include>
52+
</source>
53+
</phpunit>

psalm.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="7"
4+
resolveFromConfigFile="true"
5+
allFunctionsGlobal="true"
6+
ensureOverrideAttribute="false"
7+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8+
xmlns="https://getpsalm.org/schema/config"
9+
xsi:schemaLocation="https://getpsalm.org/schema/config ../../../vendor/vimeo/psalm/config.xsd"
10+
autoloader="psalm_autoload.php"
11+
cacheDirectory="build/psalm/"
12+
findUnusedBaselineEntry="true"
13+
findUnusedCode="false"
14+
>
15+
<projectFiles>
16+
<directory name="src/" />
17+
<directory name="tests/" />
18+
<ignoreFiles>
19+
<directory name="build" />
20+
<directory name="../../../vendor" />
21+
<directory name="tests/_support" />
22+
</ignoreFiles>
23+
</projectFiles>
24+
</psalm>

psalm_autoload.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
spl_autoload_register(static function (string $class): void {
6+
$prefix = 'domProjects\\CodeIgniterBreadcrumb\\';
7+
8+
if (! str_starts_with($class, $prefix)) {
9+
return;
10+
}
11+
12+
$relativePath = str_replace('\\', '/', substr($class, strlen($prefix)));
13+
$file = __DIR__ . '/src/' . $relativePath . '.php';
14+
15+
if (is_file($file)) {
16+
require_once $file;
17+
}
18+
}, true, true);
19+
20+
require __DIR__ . '/tests/bootstrap.php';

rector.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* This file is part of domprojects/codeigniter4-breadcrumb.
7+
*
8+
* (c) domProjects
9+
*
10+
* For the full copyright and license information, please view
11+
* the LICENSE file that was distributed with this source code.
12+
*/
13+
14+
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
15+
use Rector\Config\RectorConfig;
16+
use Rector\PHPUnit\Set\PHPUnitSetList;
17+
use Rector\Set\ValueObject\LevelSetList;
18+
use Rector\Set\ValueObject\SetList;
19+
use Rector\ValueObject\PhpVersion;
20+
21+
return static function (RectorConfig $rectorConfig): void {
22+
$rectorConfig->sets([
23+
SetList::DEAD_CODE,
24+
LevelSetList::UP_TO_PHP_82,
25+
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
26+
PHPUnitSetList::PHPUNIT_100,
27+
]);
28+
29+
$rectorConfig->parallel();
30+
$rectorConfig->cacheClass(FileCacheStorage::class);
31+
32+
if (is_dir('/tmp')) {
33+
$rectorConfig->cacheDirectory('/tmp/rector');
34+
}
35+
36+
$rectorConfig->paths([
37+
__DIR__ . '/src/',
38+
__DIR__ . '/tests/',
39+
]);
40+
41+
$rectorConfig->autoloadPaths([
42+
__DIR__ . '/../../../vendor/autoload.php',
43+
]);
44+
45+
$rectorConfig->bootstrapFiles([
46+
__DIR__ . '/tests/bootstrap.php',
47+
]);
48+
49+
if (is_file(__DIR__ . '/phpstan.neon.dist')) {
50+
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon.dist');
51+
}
52+
53+
$rectorConfig->phpVersion(PhpVersion::PHP_82);
54+
$rectorConfig->importNames();
55+
56+
$rectorConfig->skip([
57+
__DIR__ . '/tests/_support',
58+
]);
59+
};

rename-test.tmp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ok

0 commit comments

Comments
 (0)