-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from poprazvan17/3.0
implemented phpUnit test, psalm, phpcs and static analysis
- Loading branch information
Showing
21 changed files
with
400 additions
and
79 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,46 @@ | ||
on: | ||
- push | ||
|
||
name: Run phpcs checks | ||
|
||
jobs: | ||
mutation: | ||
name: PHP ${{ matrix.php }}-${{ matrix.os }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
|
||
php: | ||
- "8.1" | ||
- "8.2" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php }}" | ||
tools: composer:v2, cs2pr | ||
coverage: none | ||
|
||
- name: Determine composer cache directory | ||
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.COMPOSER_CACHE_DIR }} | ||
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: | | ||
php${{ matrix.php }}-composer- | ||
- name: Install dependencies with composer | ||
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi | ||
|
||
- name: Run phpcs checks | ||
run: vendor/bin/phpcs |
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,46 @@ | ||
on: | ||
- push | ||
|
||
name: Run static analysis | ||
|
||
jobs: | ||
mutation: | ||
name: PHP ${{ matrix.php }}-${{ matrix.os }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
|
||
php: | ||
- "8.1" | ||
- "8.2" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php }}" | ||
tools: composer:v2, cs2pr | ||
coverage: none | ||
|
||
- name: Determine composer cache directory | ||
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.COMPOSER_CACHE_DIR }} | ||
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: | | ||
php${{ matrix.php }}-composer- | ||
- name: Install dependencies with composer | ||
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi | ||
|
||
- name: Run static analysis | ||
run: vendor/bin/psalm --no-cache --output-format=github --show-info=false --threads=4 |
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,47 @@ | ||
on: | ||
- push | ||
|
||
name: Run PHPUnit tests | ||
|
||
jobs: | ||
mutation: | ||
name: PHP ${{ matrix.php }}-${{ matrix.os }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
|
||
php: | ||
- "8.1" | ||
- "8.2" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "${{ matrix.php }}" | ||
tools: composer:v2, cs2pr | ||
coverage: none | ||
|
||
- name: Determine composer cache directory | ||
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV | ||
|
||
- name: Cache dependencies installed with composer | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.COMPOSER_CACHE_DIR }} | ||
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: | | ||
php${{ matrix.php }}-composer- | ||
- name: Install dependencies with composer | ||
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi | ||
|
||
- name: Run PHPUnit tests | ||
run: vendor/bin/phpunit --colors=always |
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> | ||
|
||
<arg name="basepath" value="."/> | ||
<arg name="cache" value=".phpcs-cache"/> | ||
<arg name="colors"/> | ||
<arg name="extensions" value="php"/> | ||
<arg name="parallel" value="80"/> | ||
|
||
<!-- Show progress --> | ||
<arg value="p"/> | ||
|
||
<!-- Paths to check --> | ||
<file>src</file> | ||
<file>test</file> | ||
|
||
<!-- Include all rules from the Laminas Coding Standard --> | ||
<rule ref="LaminasCodingStandard"/> | ||
</ruleset> |
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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="vendor/autoload.php"> | ||
<testsuites> | ||
<testsuite name="Dot Authorization Test Suite"> | ||
<directory>./test</directory> | ||
</testsuite> | ||
</testsuites> | ||
</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,15 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
errorLevel="4" | ||
findUnusedBaselineEntry="true" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" | ||
> | ||
<projectFiles> | ||
<directory name="src" /> | ||
<ignoreFiles> | ||
<directory name="vendor" /> | ||
</ignoreFiles> | ||
</projectFiles> | ||
</psalm> |
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,25 +1,10 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/dotkernel/dot-authorization/ for the canonical source repository | ||
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com) | ||
* @license https://github.com/dotkernel/dot-authorization/blob/master/LICENSE.md MIT License | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
declare(strict_types=1); | ||
|
||
namespace Dot\Authorization; | ||
|
||
/** | ||
* Interface AuthorizationInterface | ||
* @package Dot\Authorization | ||
*/ | ||
interface AuthorizationInterface | ||
{ | ||
/** | ||
* @param string $permission | ||
* @param array $roles | ||
* @param mixed|null $context | ||
* @return bool | ||
*/ | ||
public function isGranted(string $permission, array $roles = [], $context = null): bool; | ||
public function isGranted(string $permission, array $roles = [], mixed $context = null): bool; | ||
} |
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,19 +1,9 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/dotkernel/dot-authorization/ for the canonical source repository | ||
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com) | ||
* @license https://github.com/dotkernel/dot-authorization/blob/master/LICENSE.md MIT License | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
declare(strict_types=1); | ||
|
||
namespace Dot\Authorization\Exception; | ||
|
||
/** | ||
* Interface ExceptionInterface | ||
* @package Dot\Authorization\Exception | ||
*/ | ||
interface ExceptionInterface | ||
{ | ||
|
||
} |
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,19 +1,9 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/dotkernel/dot-authorization/ for the canonical source repository | ||
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com) | ||
* @license https://github.com/dotkernel/dot-authorization/blob/master/LICENSE.md MIT License | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
declare(strict_types=1); | ||
|
||
namespace Dot\Authorization\Exception; | ||
|
||
/** | ||
* Class RuntimeException | ||
* @package Dot\Authorization\Exception | ||
*/ | ||
class RuntimeException extends \RuntimeException implements ExceptionInterface | ||
{ | ||
|
||
} |
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,22 +1,10 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/dotkernel/dot-authorization/ for the canonical source repository | ||
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com) | ||
* @license https://github.com/dotkernel/dot-authorization/blob/master/LICENSE.md MIT License | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
declare(strict_types=1); | ||
|
||
namespace Dot\Authorization\Role; | ||
|
||
/** | ||
* Interface RoleInterface | ||
* @package Dot\Authorization\Role | ||
*/ | ||
interface RoleInterface | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string; | ||
} |
Oops, something went wrong.