Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.github export-ignore
/docs export-ignore
/examples export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/phpstan.neon.dist export-ignore

# Configure diff output for .php and .phar files.
*.php diff=php
*.phar -diff
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
74 changes: 74 additions & 0 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# When a PR is opened or a push is made, perform
# a static analysis check on the code using PHPStan.
name: PHPStan

on:
pull_request:
branches:
- 'develop'
paths:
- 'src/**'
- 'tests/**'
- 'composer.**'
- 'phpstan*'
- '.github/workflows/analyze.yml'
push:
branches:
- 'develop'
paths:
- 'src/**'
- 'tests/**'
- 'composer.**'
- 'phpstan*'
- '.github/workflows/analyze.yml'

jobs:
build:
name: PHP ${{ matrix.php-versions }} Static Analysis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl, phpunit
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Create composer cache directory
run: mkdir -p ${{ steps.composer-cache.outputs.dir }}

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Create PHPStan cache directory
run: mkdir -p build/phpstan

- name: Cache PHPStan results
uses: actions/cache@v2
with:
path: build/phpstan
key: ${{ runner.os }}-phpstan-${{ github.sha }}
restore-keys: ${{ runner.os }}-phpstan-

- name: Install dependencies
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

- name: Run static analysis
run: vendor/bin/phpstan analyze
80 changes: 80 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: PHPUnit

on:
pull_request:
branches:
- develop
push:
branches:
- develop

jobs:
main:
name: PHP ${{ matrix.php-versions }} Unit Tests

strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0']

runs-on: ubuntu-latest

if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl, phpunit
extensions: intl, json, mbstring, gd, mysqlnd, xdebug, xml, sqlite3
coverage: xdebug

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

- name: Test with PHPUnit
run: vendor/bin/phpunit --verbose --coverage-text
env:
TERM: xterm-256color

- if: matrix.php-versions == '8.0'
name: Mutate with Infection
run: |
composer global require infection/infection
git fetch --depth=1 origin $GITHUB_BASE_REF
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

- if: matrix.php-versions == '8.0'
name: Run Coveralls
run: vendor/bin/php-coveralls --verbose --coverage_clover=build/phpunit/clover.xml --json_path build/phpunit/coveralls-upload.json
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }}

coveralls:
needs: [main]
name: Coveralls Finished
runs-on: ubuntu-latest
steps:
- name: Upload Coveralls results
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ vendor/
build/
phpunit*.xml
phpunit
*.cache
composer.lock
.DS_Store
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Tatter\Forms
RESTful AJAX forms for CodeIgniter 4

[![](https://github.com/tattersoftware/codeigniter4-forms/workflows/PHPUnit/badge.svg)](https://github.com/tattersoftware/codeigniter4-forms/actions?query=workflow%3A%22PHPUnit)
[![](https://github.com/tattersoftware/codeigniter4-forms/workflows/PHPStan/badge.svg)](https://github.com/tattersoftware/codeigniter4-forms/actions?query=workflow%3A%22PHPStan)
[![Coverage Status](https://coveralls.io/repos/github/tattersoftware/codeigniter4-forms/badge.svg?branch=develop)](https://coveralls.io/github/tattersoftware/codeigniter4-forms?branch=develop)

## Quick Start

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

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

## Usage
Expand Down
44 changes: 24 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "tatter/forms",
"type": "library",
"description": "RESTful AJAX forms for CodeIgniter 4",
"keywords": [
"codeigniter",
Expand All @@ -20,40 +21,43 @@
"role": "Developer"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/codeigniter4/CodeIgniter4"
}
],
"minimum-stability": "dev",
"require": {
"php" : ">=7.2",
"tatter/assets": "^2.0",
"php": "^7.3 || ^8.0",
"components/jquery": "^3.3",
"tatter/alerts": "^2.0",
"components/jquery": "^3.3",
"twbs/bootstrap": "^4.3"
"tatter/assets": "^2.0",
"twbs/bootstrap": "^4.3"
},
"require-dev": {
"codeigniter4/codeigniter4": "dev-develop",
"mikey179/vfsstream": "1.6.*",
"mockery/mockery": "^1.0",
"phpunit/phpunit" : "^7.0"
"mikey179/vfsstream": "^1.6",
"tatter/tools": "^1.7"
},
"autoload": {
"psr-4": {
"Tatter\\Forms\\": "src"
}
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
"ModuleTests\\Support\\": "tests/_support"
"Tests\\Support\\": "tests/_support"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/codeigniter4/CodeIgniter4"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"test": "phpunit",
"post-update-cmd": [
"composer dump-autoload"
]
"analyze": "phpstan analyze",
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
"style": "phpcbf --standard=./vendor/codeigniter4/codeigniter4-standard/CodeIgniter4 tests/ src/",
"test": "phpunit"
}
}
File renamed without changes.
19 changes: 19 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"source": {
"directories": [
"src"
],
"excludes": [
"Config",
"Database/Migrations",
"Views"
]
},
"logs": {
"text": "build/infection.log"
},
"mutators": {
"@default": true
},
"bootstrap": "vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php"
}
21 changes: 21 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
parameters:
tmpDir: build/phpstan
level: 5
paths:
- src
- tests
bootstrapFiles:
- vendor/codeigniter4/codeigniter4/system/Test/bootstrap.php
excludes_analyse:
- src/Config/Routes.php
- src/Views/*
ignoreErrors:
universalObjectCratesClasses:
- CodeIgniter\Entity
- Faker\Generator
scanDirectories:
- vendor/codeigniter4/codeigniter4/system/Helpers
dynamicConstantNames:
- APP_NAMESPACE
- CI_DEBUG
- ENVIRONMENT
Loading