Skip to content
Open
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
9 changes: 7 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: actions/setup-php@v2
with:
php-version: '7.4'

- name: Validate composer.json and composer.lock
run: composer validate

Expand All @@ -33,5 +38,5 @@ jobs:
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# - name: Run test suite
# run: composer run-script test
- name: Run test suite
run: composer run-script test
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"php": "^7.2"
"php": "^7.4"
},
"keywords": ["PHP", "laravel", "Regex", "Persian Regex", "Pregex", "Sedhossein"],
"require-dev" : {
Expand All @@ -31,5 +31,8 @@
"psr-4": {
"Sedhossein\\Pregex\\Tests\\": "tests/"
}
},
"scripts": {
"test": "vendor/bin/phpunit"
}
}
3 changes: 0 additions & 3 deletions src/Pregex.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ public function IsIban(string $value): bool
return $tmpValue != 1 ? false : true;
}

/**
* @codeCoverageIgnore
*/
public function IsNationalCode(string $value): bool
{
if (
Expand Down
11 changes: 9 additions & 2 deletions tests/PregexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ public function ValidNationalCode(): array
return [
// TODO: this repo tested with personal national code,
// but for security issues i ignore this test on open-source
["0012345679"],
["1234567891"],
["0499528654"],
];
}

Expand All @@ -212,7 +215,11 @@ public function InvalidNationalCode(): array
["0000000000"], ["1111111111"], ["2222222222"],
["3333333333"], ["4444444444"], ["5555555555"],
["6666666666"], ["7777777777"], ["8888888888"],
["9999999999"], [""]
["9999999999"], [""],
["0012345670"], // incorrect control digit
["1234567"], // too short
["12345678901"],// too long
["abcdefghij"], // non-numeric
];
}

Expand Down Expand Up @@ -451,7 +458,7 @@ public function invalid_persian_names(): array
// ============================== Without Persian Alphabet validations ==============================

/**
* @dataProvider test_invalid_without_persian_alphabet
* @dataProvider valid_without_persian_alphabets
*/
public function test_valid_without_persian_alphabet(string $string)
{
Expand Down
Loading