-
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.
Merge pull request #7 from BaguettePHP/add-php54-ci
Setup CI for PHP 5.4 to 8.1
- Loading branch information
Showing
8 changed files
with
88 additions
and
12 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,51 @@ | ||
name: Test | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- '**.md' | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- '**.md' | ||
jobs: | ||
run: | ||
name: Run | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ubuntu-20.04] | ||
php-versions: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] | ||
env: | ||
key: cache-v1 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup PHP with tools | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, intl, opcache, xdebug, xml | ||
tools: composer, cs2pr | ||
- name: Get Composer cache directory | ||
id: composer-cache-dir | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Restore composer cache | ||
id: composer-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache-dir.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Remove composer.lock | ||
run: rm -f composer.lock | ||
- name: Setup Composer | ||
run: composer install | ||
- name: Run PHPUnit tests | ||
run: vendor/bin/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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
/composer.lock | ||
/phpunit.xml | ||
/vendor/* | ||
/.phpunit.result.cache | ||
/.idea | ||
/*.iml | ||
/tests/db.sq3 | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
|
||
use Teto\SQL\Query; | ||
use Teto\SQL\DummyPDO; | ||
use Yoast\PHPUnitPolyfills\Polyfills\ExpectException; | ||
use Yoast\PHPUnitPolyfills\Polyfills\ExpectPHPException; | ||
|
||
/** | ||
* @author USAMI Kenta <[email protected]> | ||
|
@@ -12,6 +14,9 @@ | |
*/ | ||
final class ReplaceHolderTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
use ExpectException; | ||
use ExpectPHPException; | ||
|
||
/** | ||
* @dataProvider acceptDataProvider | ||
*/ | ||
|
@@ -21,7 +26,7 @@ public function test_accept($type, $input, $expected) | |
|
||
$actual = call_user_func(\Closure::bind(function () use ($pdo, $type, $input) { | ||
return Query::replaceHolder($pdo, ':key', "@{$type}", $input, $bind_values); | ||
}, null, Query::class)); | ||
}, null, 'Teto\SQL\Query')); | ||
|
||
$this->assertSame($expected, $actual); | ||
} | ||
|
@@ -59,12 +64,12 @@ public function test_raise_exception($type, $input, $expected_message) | |
{ | ||
$pdo = new DummyPDO(); | ||
|
||
$this->expectException(\DomainException::class); | ||
$this->expectException('DomainException'); | ||
$this->expectExceptionMessage($expected_message); | ||
|
||
call_user_func(\Closure::bind(function () use ($pdo, $type, $input) { | ||
return Query::replaceHolder($pdo, ':key', $type, $input, $bind_values); | ||
}, null, Query::class)); | ||
}, null, 'Teto\SQL\Query')); | ||
} | ||
|
||
public function rejeceptDataProvider() | ||
|
@@ -79,7 +84,7 @@ public function rejeceptDataProvider() | |
['@int', '-9223372036854775809', 'param ":key" is integer out of range.'], | ||
['@int[]', 0, 'param ":key" must be int array'], | ||
['@int[]', [], 'param ":key" must be not empty int array'], | ||
['@int[]', ['1', 'a', '3'], 'param ":key[]" is integer out of range.'], | ||
['@int[]', ['1', 'a', '3'], 'param ":key[1]" is integer out of range.'], | ||
['@string', [], 'param ":key" must be string or numeric'], | ||
['@string[]', '', 'param ":key" must be string array'], | ||
['@string[]', [], 'param ":key" must be not empty string array'], | ||
|
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,12 +1,15 @@ | ||
<?php | ||
|
||
namespace Teto\SQL; | ||
|
||
use Yoast\PHPUnitPolyfills\TestCases\TestCase; | ||
|
||
/** | ||
* @author USAMI Kenta <[email protected]> | ||
* @copyright 2016 USAMI Kenta | ||
* @license https://github.com/BaguettePHP/TetoSQL/blob/master/LICENSE MPL-2.0 | ||
*/ | ||
final class QueryTest extends \PHPUnit\Framework\TestCase | ||
final class QueryTest extends TestCase | ||
{ | ||
public function test() | ||
{ | ||
|
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