Skip to content

Commit 14e5607

Browse files
authored
Merge b088327 into 9109f96
2 parents 9109f96 + b088327 commit 14e5607

33 files changed

+1115
-745
lines changed

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/.github export-ignore
2+
/docs export-ignore
3+
/examples export-ignore
4+
/tests export-ignore
5+
/.editorconfig export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/phpstan.neon.dist export-ignore
10+
11+
# Configure diff output for .php and .phar files.
12+
*.php diff=php
13+
*.phar -diff

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: daily

.github/workflows/analyze.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# When a PR is opened or a push is made, perform
2+
# a static analysis check on the code using PHPStan.
3+
name: PHPStan
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- 'develop'
9+
paths:
10+
- 'src/**'
11+
- 'tests/**'
12+
- 'composer.**'
13+
- 'phpstan*'
14+
- '.github/workflows/analyze.yml'
15+
push:
16+
branches:
17+
- 'develop'
18+
paths:
19+
- 'src/**'
20+
- 'tests/**'
21+
- 'composer.**'
22+
- 'phpstan*'
23+
- '.github/workflows/analyze.yml'
24+
25+
jobs:
26+
build:
27+
name: PHP ${{ matrix.php-versions }} Static Analysis
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
php-versions: ['7.3', '7.4', '8.0']
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
39+
with:
40+
php-version: ${{ matrix.php-versions }}
41+
tools: composer, pecl, phpunit
42+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
43+
44+
- name: Get composer cache directory
45+
id: composer-cache
46+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
47+
48+
- name: Create composer cache directory
49+
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}
50+
51+
- name: Cache composer dependencies
52+
uses: actions/cache@v2
53+
with:
54+
path: ${{ steps.composer-cache.outputs.dir }}
55+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
56+
restore-keys: ${{ runner.os }}-composer-
57+
58+
- name: Create PHPStan cache directory
59+
run: mkdir -p build/phpstan
60+
61+
- name: Cache PHPStan results
62+
uses: actions/cache@v2
63+
with:
64+
path: build/phpstan
65+
key: ${{ runner.os }}-phpstan-${{ github.sha }}
66+
restore-keys: ${{ runner.os }}-phpstan-
67+
68+
- name: Install dependencies
69+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
70+
env:
71+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
72+
73+
- name: Run static analysis
74+
run: vendor/bin/phpstan analyze

.github/workflows/test.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: PHPUnit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
push:
8+
branches:
9+
- develop
10+
11+
jobs:
12+
main:
13+
name: PHP ${{ matrix.php-versions }} Unit Tests
14+
15+
strategy:
16+
matrix:
17+
php-versions: ['7.3', '7.4', '8.0']
18+
19+
runs-on: ubuntu-latest
20+
21+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
27+
- name: Setup PHP, with composer and extensions
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php-versions }}
31+
tools: composer, pecl, phpunit
32+
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
33+
coverage: xdebug
34+
35+
- name: Get composer cache directory
36+
id: composer-cache
37+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
38+
39+
- name: Cache composer dependencies
40+
uses: actions/cache@v2
41+
with:
42+
path: ${{ steps.composer-cache.outputs.dir }}
43+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
44+
restore-keys: ${{ runner.os }}-composer-
45+
46+
- name: Install dependencies
47+
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
48+
env:
49+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
50+
51+
- name: Test with PHPUnit
52+
run: vendor/bin/phpunit --verbose --coverage-text
53+
env:
54+
TERM: xterm-256color
55+
56+
- if: matrix.php-versions == '8.0'
57+
name: Mutate with Infection
58+
run: |
59+
composer global require infection/infection
60+
git fetch --depth=1 origin $GITHUB_BASE_REF
61+
infection --threads=2 --skip-initial-tests --coverage=build/phpunit --git-diff-base=origin/$GITHUB_BASE_REF --git-diff-filter=AM --logger-github --ignore-msi-with-no-mutations
62+
63+
- if: matrix.php-versions == '8.0'
64+
name: Run Coveralls
65+
run: vendor/bin/php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
66+
env:
67+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
COVERALLS_PARALLEL: true
69+
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }}
70+
71+
coveralls:
72+
needs: [main]
73+
name: Coveralls Finished
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Upload Coveralls results
77+
uses: coverallsapp/github-action@master
78+
with:
79+
github-token: ${{ secrets.GITHUB_TOKEN }}
80+
parallel-finished: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ vendor/
22
build/
33
phpunit*.xml
44
phpunit
5+
*.cache
56
composer.lock
67
.DS_Store

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Tatter\Forms
22
RESTful AJAX forms for CodeIgniter 4
33

4+
[![](https://github.com/tattersoftware/codeigniter4-forms/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/codeigniter4-forms/actions?query=workflow%3A%22PHPUnit)
5+
[![](https://github.com/tattersoftware/codeigniter4-forms/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/codeigniter4-forms/actions?query=workflow%3A%22PHPStan)
6+
[![Coverage Status](https://coveralls.io/repos/github/tattersoftware/codeigniter4-forms/badge.svg?branch=develop)](https://coveralls.io/github/tattersoftware/codeigniter4-forms?branch=develop)
7+
48
## Quick Start
59

610
1. Install with Composer: `> composer require tatter/forms`
@@ -46,7 +50,7 @@ may vary):
4650
## Configuration (optional)
4751

4852
The library's default behavior can be overridden or augment by its config file. Copy
49-
**bin/Forms.php** to **app/Config/Forms.php** and follow the instructions in the
53+
**examples/Forms.php** to **app/Config/Forms.php** and follow the instructions in the
5054
comments. If no config file is found the library will use its defaults.
5155

5256
## Usage

composer.json

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "tatter/forms",
3+
"type": "library",
34
"description": "RESTful AJAX forms for CodeIgniter 4",
45
"keywords": [
56
"codeigniter",
@@ -20,40 +21,43 @@
2021
"role": "Developer"
2122
}
2223
],
23-
"repositories": [
24-
{
25-
"type": "vcs",
26-
"url": "https://github.com/codeigniter4/CodeIgniter4"
27-
}
28-
],
29-
"minimum-stability": "dev",
3024
"require": {
31-
"php" : ">=7.2",
32-
"tatter/assets": "^2.0",
25+
"php": "^7.3 || ^8.0",
26+
"components/jquery": "^3.3",
3327
"tatter/alerts": "^2.0",
34-
"components/jquery": "^3.3",
35-
"twbs/bootstrap": "^4.3"
28+
"tatter/assets": "^2.0",
29+
"twbs/bootstrap": "^4.3"
3630
},
3731
"require-dev": {
3832
"codeigniter4/codeigniter4": "dev-develop",
39-
"mikey179/vfsstream": "1.6.*",
40-
"mockery/mockery": "^1.0",
41-
"phpunit/phpunit" : "^7.0"
33+
"mikey179/vfsstream": "^1.6",
34+
"tatter/tools": "^1.7"
4235
},
4336
"autoload": {
4437
"psr-4": {
4538
"Tatter\\Forms\\": "src"
46-
}
39+
},
40+
"exclude-from-classmap": [
41+
"**/Database/Migrations/**"
42+
]
4743
},
4844
"autoload-dev": {
4945
"psr-4": {
50-
"ModuleTests\\Support\\": "tests/_support"
46+
"Tests\\Support\\": "tests/_support"
5147
}
5248
},
49+
"repositories": [
50+
{
51+
"type": "vcs",
52+
"url": "https://github.com/codeigniter4/CodeIgniter4"
53+
}
54+
],
55+
"minimum-stability": "dev",
56+
"prefer-stable": true,
5357
"scripts": {
54-
"test": "phpunit",
55-
"post-update-cmd": [
56-
"composer dump-autoload"
57-
]
58+
"analyze": "phpstan analyze",
59+
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
60+
"style": "phpcbf --standard=./vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 tests/ src/",
61+
"test": "phpunit"
5862
}
5963
}
File renamed without changes.

infection.json.dist

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"source": {
3+
"directories": [
4+
"src"
5+
],
6+
"excludes": [
7+
"Config",
8+
"Database/Migrations",
9+
"Views"
10+
]
11+
},
12+
"logs": {
13+
"text": "build/infection.log"
14+
},
15+
"mutators": {
16+
"@default": true
17+
},
18+
"bootstrap": "vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php"
19+
}

phpstan.neon.dist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
parameters:
2+
tmpDir: build/phpstan
3+
level: 5
4+
paths:
5+
- src
6+
- tests
7+
bootstrapFiles:
8+
- vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php
9+
excludes_analyse:
10+
- src/Config/Routes.php
11+
- src/Views/*
12+
ignoreErrors:
13+
- '#Cannot access property \$[A-Za-z]+ on array\|object#'
14+
universalObjectCratesClasses:
15+
- CodeIgniter\Entity
16+
- Faker\Generator
17+
scanDirectories:
18+
- vendor/codeigniter4/codeigniter4/system/Helpers
19+
dynamicConstantNames:
20+
- APP_NAMESPACE
21+
- CI_DEBUG
22+
- ENVIRONMENT

0 commit comments

Comments
 (0)