-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
573 additions
and
6 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,45 @@ | ||
on: | ||
push: | ||
branches: [ 'master' ] | ||
pull_request: | ||
branches: [ 'master' ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-versions: [ '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] | ||
|
||
name: Run Unit Test on PHP ${{ matrix.php-versions }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
|
||
- name: Check the PHP version | ||
run: php -v | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate --strict | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress | ||
|
||
- name: Run test suite | ||
run: vendor/bin/phpunit --coverage-clover=coverage.clover | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
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
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,56 @@ | ||
<?php | ||
|
||
namespace Rougin\Authsum; | ||
|
||
use Rougin\Authsum\Source\SourceInterface; | ||
use UnexpectedValueException; | ||
|
||
/** | ||
* @package Authsum | ||
* | ||
* @author Rougin Gutib <rougingutib@gmail.com> | ||
*/ | ||
abstract class Source implements SourceInterface | ||
{ | ||
/** | ||
* @var \Rougin\Authsum\Error|null | ||
*/ | ||
protected $error = null; | ||
|
||
/** | ||
* @var \Rougin\Authsum\Result|null | ||
*/ | ||
protected $result = null; | ||
|
||
/** | ||
* Returns the error after validation. | ||
* | ||
* @return \Rougin\Authsum\Error | ||
* @throws \UnexpectedValueException | ||
*/ | ||
public function getError() | ||
{ | ||
if (! $this->error) | ||
{ | ||
throw new UnexpectedValueException('Validation passed'); | ||
} | ||
|
||
return $this->error; | ||
} | ||
|
||
/** | ||
* Returns the result after validation. | ||
* | ||
* @return \Rougin\Authsum\Result | ||
* @throws \UnexpectedValueException | ||
*/ | ||
public function getResult() | ||
{ | ||
if (! $this->result) | ||
{ | ||
throw new UnexpectedValueException('Validation failed'); | ||
} | ||
|
||
return $this->result; | ||
} | ||
} |
Oops, something went wrong.