Skip to content

Commit 1635a8a

Browse files
authored
Merge pull request #10 from sun-asterisk/feature/unit-test
Feature/unit test
2 parents 5f8b3ac + bac42e5 commit 1635a8a

17 files changed

+3171
-35
lines changed

.github/workflows/check_ci.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Run PHP Unit Test
2+
3+
on:
4+
pull_request:
5+
branches: [master, develop, php]
6+
7+
jobs:
8+
phpcs:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Setup PHP
13+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
14+
with:
15+
php-version: 8.0
16+
tools: phpcs
17+
- name: Install PHP standard
18+
run: |
19+
git clone https://github.com/wataridori/framgia-php-codesniffer.git ~/squizlabs/php_codesniffer/src/Standards/Framgia
20+
phpcs --config-set installed_paths ~/squizlabs/php_codesniffer/src/Standards/Framgia
21+
- name: Run phpcs
22+
run: |
23+
phpcs --standard=Framgia src --encoding=utf-8
24+
25+
phpunit:
26+
needs: [phpcs]
27+
runs-on: ubuntu-20.04
28+
steps:
29+
- uses: actions/checkout@v2
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
32+
with:
33+
php-version: 8.0
34+
tools: phpunit
35+
- name: Get Composer Cache Directory
36+
id: composer-cache
37+
run: |
38+
echo "::set-output name=dir::$(composer config cache-files-dir)"
39+
- name: Cache Composer Downloads
40+
uses: actions/cache@v1
41+
with:
42+
path: ${{ steps.composer-cache.outputs.dir }}
43+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
44+
restore-keys: |
45+
${{ runner.os }}-composer-
46+
- name: Cache PHP dependencies
47+
uses: actions/cache@v1
48+
with:
49+
path: vendor
50+
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
51+
- name: Install dependencies
52+
run: composer install --prefer-dist
53+
- name: Run unit
54+
run: php -dextension=pcov.so -dpcov.enabled=1 vendor/bin/phpunit --verbose

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/vendor/
2+
.phpunit.cache
3+
.phpunit.result.cache

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Tech Standard PHP Auth
22

3+
[![CI](https://github.com/sun-asterisk/tech-standard-php-auth/actions/workflows/check_ci.yml/badge.svg)](https://github.com/sun-asterisk/tech-standard-php-auth/actions/workflows/check_ci.yml)
4+
35
## Table of Contents
46
- [Laravel Installation](#laravel-installation)
57
- [Lumen Installation](#lumen-installation)

composer.json

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"SunAsterisk\\Auth\\": "src/"
99
}
1010
},
11+
"autoload-dev": {
12+
"psr-4": {
13+
"SunAsterisk\\Auth\\Tests\\": "tests/"
14+
}
15+
},
1116
"authors": [
1217
{
1318
"name": "Sun Asterisk",
@@ -24,5 +29,9 @@
2429
"illuminate/validation": "^8.0|^9.0|^10.0",
2530
"firebase/php-jwt": "^6.3",
2631
"socialiteproviders/manager": "^4.3"
32+
},
33+
"require-dev": {
34+
"phpunit/phpunit": "^9.6",
35+
"mockery/mockery": "^1.5"
2736
}
2837
}

0 commit comments

Comments
 (0)