parent
bf7ac2668e
commit
55951419d0
17 changed files with 4501 additions and 0 deletions
37
.forgejo/workflows/pull_request.yml
Normal file
37
.forgejo/workflows/pull_request.yml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
on: [pull_request]
|
||||||
|
jobs:
|
||||||
|
ls:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: git.php.fail/lubiana/container/php:ci
|
||||||
|
steps:
|
||||||
|
- name: Manually checkout
|
||||||
|
env:
|
||||||
|
REPO: '${{ github.repository }}'
|
||||||
|
TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
|
GIT_SERVER: 'git.php.fail'
|
||||||
|
run: |
|
||||||
|
git clone --branch $GITHUB_HEAD_REF https://${TOKEN}@${GIT_SERVER}/${REPO}.git .
|
||||||
|
git fetch
|
||||||
|
git checkout $GITHUB_HEAD_REF
|
||||||
|
- name: composer install
|
||||||
|
env:
|
||||||
|
COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ env.COMPOSER_CACHE_DIR }}
|
||||||
|
composer install
|
||||||
|
- name: lint
|
||||||
|
run: composer lint
|
||||||
|
- name: test
|
||||||
|
run: composer test
|
||||||
|
- name: GIT commit and push all changed files
|
||||||
|
env:
|
||||||
|
CI_COMMIT_MESSAGE: Continuous Integration Fixes
|
||||||
|
CI_COMMIT_AUTHOR: Continuous Integration
|
||||||
|
run: |
|
||||||
|
if [[ -n "$(git status -s)" ]]; then
|
||||||
|
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
|
||||||
|
git config --global user.email "gitbot@users.noreply.php.fail"
|
||||||
|
git commit -am "${{ env.CI_COMMIT_MESSAGE }}"
|
||||||
|
git push
|
||||||
|
fi
|
41
.forgejo/workflows/push.yml
Normal file
41
.forgejo/workflows/push.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
jobs:
|
||||||
|
ls:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: git.php.fail/lubiana/container/php:ci
|
||||||
|
steps:
|
||||||
|
- name: Manually checkout
|
||||||
|
env:
|
||||||
|
REPO: '${{ github.repository }}'
|
||||||
|
TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
|
BRANCH: '${{ env.GITHUB_REF_NAME }}'
|
||||||
|
GIT_SERVER: 'git.php.fail'
|
||||||
|
run: |
|
||||||
|
git clone --branch $GITHUB_REF_NAME https://${TOKEN}@${GIT_SERVER}/${REPO}.git .
|
||||||
|
git fetch
|
||||||
|
git checkout ${{ github.head_ref }}
|
||||||
|
- name: composer install
|
||||||
|
env:
|
||||||
|
COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files
|
||||||
|
run: |
|
||||||
|
mkdir -p ${{ env.COMPOSER_CACHE_DIR }}
|
||||||
|
composer install
|
||||||
|
- name: lint
|
||||||
|
run: composer lint
|
||||||
|
- name: test
|
||||||
|
run: composer test
|
||||||
|
- name: GIT commit and push all changed files
|
||||||
|
env:
|
||||||
|
CI_COMMIT_MESSAGE: Continuous Integration Fixes
|
||||||
|
CI_COMMIT_AUTHOR: Continuous Integration
|
||||||
|
run: |
|
||||||
|
if [[ -n "$(git status -s)" ]]; then
|
||||||
|
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
|
||||||
|
git config --global user.email "gitbot@users.noreply.php.fail"
|
||||||
|
git commit -am "${{ env.CI_COMMIT_MESSAGE }}"
|
||||||
|
git push
|
||||||
|
fi
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/vendor/
|
||||||
|
/.php-styler.cache
|
||||||
|
/.idea/
|
||||||
|
/var/
|
9
code-quality-paths.php
Normal file
9
code-quality-paths.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
return [
|
||||||
|
__DIR__ . '/src',
|
||||||
|
__DIR__ . '/tests',
|
||||||
|
__DIR__ . '/php-styler.php',
|
||||||
|
__DIR__ . '/ecs.php',
|
||||||
|
__DIR__ . '/rector.php',
|
||||||
|
];
|
45
composer.json
Normal file
45
composer.json
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "lubiana/base",
|
||||||
|
"description": "my base skeleton",
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Lubiana\\Base\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "lubiana",
|
||||||
|
"email": "lubiana@hannover.ccc.de"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require-dev": {
|
||||||
|
"lubiana/code-quality": "^1.7",
|
||||||
|
"pmjones/php-styler": "^0.16.0",
|
||||||
|
"phpstan/phpstan": "^1.11",
|
||||||
|
"phpstan/phpstan-strict-rules": "^1.6",
|
||||||
|
"phpstan/extension-installer": "^1.3",
|
||||||
|
"pestphp/pest": "^2.34"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"allow-plugins": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||||
|
"phpstan/extension-installer": true,
|
||||||
|
"pestphp/pest-plugin": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": [
|
||||||
|
"rector",
|
||||||
|
"php-styler apply",
|
||||||
|
"ecs --fix || ecs --fix"
|
||||||
|
],
|
||||||
|
"phpstan": "phpstan analyze",
|
||||||
|
"test": "pest"
|
||||||
|
}
|
||||||
|
}
|
4249
composer.lock
generated
Normal file
4249
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
11
ecs.php
Normal file
11
ecs.php
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
use Lubiana\CodeQuality\LubiSetList;
|
||||||
|
use PhpCsFixer\Fixer\ClassNotation\FinalClassFixer;
|
||||||
|
use Symplify\EasyCodingStandard\Config\ECSConfig;
|
||||||
|
|
||||||
|
return ECSConfig::configure()
|
||||||
|
->withPaths(require __DIR__ . '/code-quality-paths.php')
|
||||||
|
->withRootFiles()
|
||||||
|
->withRules([FinalClassFixer::class])
|
||||||
|
->withSets([LubiSetList::ECS]);
|
13
php-styler.php
Normal file
13
php-styler.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
use PhpStyler\Config;
|
||||||
|
use PhpStyler\Files;
|
||||||
|
use PhpStyler\Styler;
|
||||||
|
|
||||||
|
$paths = (require __DIR__ . '/code-quality-paths.php');
|
||||||
|
|
||||||
|
return new Config(
|
||||||
|
styler: new Styler,
|
||||||
|
files: new Files(...$paths),
|
||||||
|
cache: __DIR__ . '/.php-styler.cache',
|
||||||
|
);
|
0
phpstan-baseline.neon
Normal file
0
phpstan-baseline.neon
Normal file
6
phpstan.neon
Normal file
6
phpstan.neon
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
includes:
|
||||||
|
- phpstan-baseline.neon
|
||||||
|
parameters:
|
||||||
|
level: 9
|
||||||
|
paths:
|
||||||
|
- src
|
18
phpunit.xml
Normal file
18
phpunit.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
colors="true"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Test Suite">
|
||||||
|
<directory suffix="Test.php">./tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">./app</directory>
|
||||||
|
<directory suffix=".php">./src</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
|
</phpunit>
|
12
rector.php
Normal file
12
rector.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
use Lubiana\CodeQuality\LubiSetList;
|
||||||
|
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
|
||||||
|
use Rector\Config\RectorConfig;
|
||||||
|
|
||||||
|
return RectorConfig::configure()
|
||||||
|
->withPaths(require __DIR__ . '/code-quality-paths.php')
|
||||||
|
->withSkip([
|
||||||
|
StaticClosureRector::class => [__DIR__ . '/tests'],
|
||||||
|
])
|
||||||
|
->withSets([LubiSetList::RECTOR]);
|
0
src/.gitkeep
Normal file
0
src/.gitkeep
Normal file
8
tests/Feature/ExampleTest.php
Normal file
8
tests/Feature/ExampleTest.php
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
test(
|
||||||
|
'example',
|
||||||
|
function (): void {
|
||||||
|
expect(true)->toBeTrue();
|
||||||
|
},
|
||||||
|
);
|
30
tests/Pest.php
Normal file
30
tests/Pest.php
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Test Case
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The closure you provide to your test functions is always bound to a specific PHPUnit test
|
||||||
|
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
|
||||||
|
| need to change it using the "uses()" function to bind a different classes or traits.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
uses(TestCase::class)->in('Feature', 'Unit');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Functions
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
|
||||||
|
| project that you don't want to repeat in every file. Here you can also expose helpers as
|
||||||
|
| global functions to help you to reduce the number of lines of code in your test files.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
function something(): void
|
||||||
|
{
|
||||||
|
// ..
|
||||||
|
}
|
10
tests/TestCase.php
Normal file
10
tests/TestCase.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Tests;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase as BaseTestCase;
|
||||||
|
|
||||||
|
abstract class TestCase extends BaseTestCase
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
8
tests/Unit/ExampleTest.php
Normal file
8
tests/Unit/ExampleTest.php
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
|
test(
|
||||||
|
'example',
|
||||||
|
function (): void {
|
||||||
|
expect(true)->toBeTrue();
|
||||||
|
},
|
||||||
|
);
|
Loading…
Reference in a new issue