-
Notifications
You must be signed in to change notification settings - Fork 10
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 #17 from imanilchaudhari/tests
add: phpunit, codecov & rector configs
- Loading branch information
Showing
6 changed files
with
141 additions
and
4 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,28 @@ | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'README.md' | ||
- 'CHANGELOG.md' | ||
- '.gitignore' | ||
- '.gitattributes' | ||
|
||
push: | ||
branches: ['master'] | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'README.md' | ||
- 'CHANGELOG.md' | ||
- '.gitignore' | ||
- '.gitattributes' | ||
|
||
name: build | ||
|
||
jobs: | ||
phpunit: | ||
uses: yiisoft/actions/.github/workflows/phpunit.yml@master | ||
with: | ||
os: >- | ||
['ubuntu-latest', 'windows-latest'] | ||
php: >- | ||
['7.4', '8.0', '8.1', '8.2', '8.3'] |
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 @@ | ||
on: [push, pull_request] | ||
|
||
name: Workflow for Codecov | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: imanilchaudhari/yii2-currency-converter |
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,21 @@ | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'README.md' | ||
- 'CHANGELOG.md' | ||
- '.gitignore' | ||
- '.gitattributes' | ||
|
||
name: rector | ||
|
||
jobs: | ||
rector: | ||
uses: yiisoft/actions/.github/workflows/rector.yml@master | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
os: >- | ||
['ubuntu-latest'] | ||
php: >- | ||
['7.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
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 @@ | ||
<?php | ||
|
||
// ensure we get report on all possible php errors | ||
error_reporting(-1); | ||
|
||
require_once(__DIR__ . '/../vendor/autoload.php'); | ||
require_once __DIR__ . '/compatibility.php'; |
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,66 @@ | ||
<?php | ||
/** | ||
* @link https://www.yiiframework.com/ | ||
* @copyright Copyright (c) 2008 Yii Software LLC | ||
* @license https://www.yiiframework.com/license/ | ||
*/ | ||
|
||
/* | ||
* Ensures compatibility with PHPUnit < 6.x | ||
*/ | ||
|
||
namespace PHPUnit\Framework\Constraint { | ||
|
||
if (!class_exists(\PHPUnit\Framework\Constraint\Constraint::class) && class_exists('PHPUnit_Framework_Constraint')) { | ||
abstract class Constraint extends \PHPUnit_Framework_Constraint | ||
{ | ||
} | ||
} | ||
} | ||
|
||
namespace PHPUnit\Framework { | ||
|
||
if (!class_exists(\PHPUnit\Framework\TestCase::class) && class_exists('PHPUnit_Framework_TestCase')) { | ||
|
||
echo "Applying compatibility patch for PHPUnit 6...\n"; | ||
|
||
abstract class TestCase extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @param string $exception | ||
*/ | ||
public function expectException($exception) | ||
{ | ||
$this->setExpectedException($exception); | ||
} | ||
|
||
/** | ||
* @param string $message | ||
*/ | ||
public function expectExceptionMessage($message) | ||
{ | ||
$parentClassMethods = get_class_methods('PHPUnit_Framework_TestCase'); | ||
if (in_array('expectExceptionMessage', $parentClassMethods)) { | ||
parent::expectExceptionMessage($message); | ||
|
||
return; | ||
} | ||
$this->setExpectedException($this->getExpectedException(), $message); | ||
} | ||
|
||
/** | ||
* @param string $messageRegExp | ||
*/ | ||
public function expectExceptionMessageRegExp($messageRegExp) | ||
{ | ||
$parentClassMethods = get_class_methods('PHPUnit_Framework_TestCase'); | ||
if (in_array('expectExceptionMessageRegExp', $parentClassMethods)) { | ||
parent::expectExceptionMessageRegExp($messageRegExp); | ||
|
||
return; | ||
} | ||
$this->setExpectedExceptionRegExp($this->getExpectedException(), $messageRegExp); | ||
} | ||
} | ||
} | ||
} |