-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests, linting and static analasis
- Loading branch information
1 parent
a495b94
commit 462f08b
Showing
10 changed files
with
279 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: run-tests | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**.php' | ||
- '.github/workflows/run-tests.yml' | ||
- 'phpunit.xml.dist' | ||
- 'composer.json' | ||
- 'composer.lock' | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 5 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
php: [ 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 ] | ||
stability: [ prefer-lowest, prefer-stable ] | ||
|
||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
|
||
- name: Setup problem matchers | ||
run: | | ||
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
- name: Install dependencies | ||
run: | | ||
composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
- name: List Installed Dependencies | ||
run: composer show -D | ||
|
||
- name: Execute tests | ||
run: vendor/bin/pest --ci --coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<?php | ||
|
||
use ParseHolyLandPhone\ParsePhone; | ||
|
||
require_once('vendor/autoload.php'); | ||
|
||
// via new instance | ||
$number = new ParsePhone('025121234'); | ||
|
||
// via static method | ||
$number = ParsePhone::create('025121234'); | ||
|
||
$number->isValid(); | ||
|
||
$number->isNotValid(); | ||
<?php | ||
|
||
use ParseHolyLandPhone\ParsePhone; | ||
|
||
require_once 'vendor/autoload.php'; | ||
|
||
// via new instance | ||
$number = new ParsePhone('025121234'); | ||
|
||
// via static method | ||
$number = ParsePhone::create('025121234'); | ||
|
||
$number->isValid(); | ||
|
||
$number->isNotValid(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
parameters: | ||
|
||
paths: | ||
- src/ | ||
|
||
# Level 9 is the highest level | ||
level: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?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">./src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"preset": "laravel", | ||
"rules": { | ||
"not_operator_with_successor_space": false, | ||
"control_structure_braces": false, | ||
"cast_spaces": { | ||
"space": "none" | ||
}, | ||
"binary_operator_spaces": { | ||
"operators": { | ||
"=>": "align" | ||
} | ||
}, | ||
"braces_position": { | ||
"allow_single_line_anonymous_functions": true, | ||
"allow_single_line_empty_anonymous_classes": true, | ||
"functions_opening_brace": "same_line" | ||
}, | ||
"function_declaration": { | ||
"closure_fn_spacing": "none" | ||
}, | ||
"concat_space": { | ||
"spacing": "one" | ||
}, | ||
"phpdoc_align": { | ||
"align": "vertical", | ||
"tags": [] | ||
}, | ||
"phpdoc_line_span": { | ||
"method": "single", | ||
"property": "single", | ||
"const": "single" | ||
}, | ||
"simplified_null_return": true, | ||
"braces": false, | ||
"new_with_braces": { | ||
"anonymous_class": false, | ||
"named_class": false | ||
} | ||
} | ||
} |
Oops, something went wrong.