Skip to content

Commit 35b6ba3

Browse files
committed
Add tests
1 parent 409c7ff commit 35b6ba3

File tree

5 files changed

+94
-1
lines changed

5 files changed

+94
-1
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
/.github export-ignore
12
/.gitattributes export-ignore
23
/.gitignore export-ignore
3-
/.gitmodules export-ignore
44
/.travis.yml export-ignore
55
/phpunit.xml export-ignore
66
/tests export-ignore

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
jobs:
10+
test:
11+
name: Test
12+
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
php-version: [
18+
'5.3', '5.4', '5.5', '5.6',
19+
'7.0', '7.1', '7.2', '7.3', '7.4',
20+
'8.0', '8.1', '8.2'
21+
]
22+
23+
steps:
24+
- name: Setup PHP ${{ matrix.php-version }}
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php-version }}
28+
29+
- name: Checkout
30+
uses: actions/checkout@v2
31+
32+
- name: Install dependencies
33+
run: composer install --quiet --no-ansi --prefer-dist --no-progress --no-interaction
34+
35+
- name: Run test suite
36+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
37+
38+
- name: Upload coverage to Codecov
39+
uses: codecov/codecov-action@v1
40+
with:
41+
token: ${{ secrets.CODECOV_TOKEN }}
42+
file: ./coverage.xml
43+
fail_ci_if_error: true

composer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@
1010
"email": "[email protected]"
1111
}
1212
],
13+
"require": {
14+
"php": "^5.3 || ^7.0 || ^8.0"
15+
},
16+
"require-dev": {
17+
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.5 || ^8.2 || ^9.3"
18+
},
1319
"autoload": {
1420
"psr-4": {
1521
"Sunaoka\\PostgresError\\": "src/"
1622
}
23+
},
24+
"autoload-dev": {
25+
"psr-4": {
26+
"Sunaoka\\PostgresError\\Tests\\": "tests/"
27+
}
1728
}
1829
}

phpunit.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
beStrictAboutTestsThatDoNotTestAnything="false"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnError="false"
12+
stopOnFailure="false"
13+
verbose="true"
14+
>
15+
<testsuites>
16+
<testsuite name="test">
17+
<directory suffix="Test.php">./tests</directory>
18+
</testsuite>
19+
</testsuites>
20+
<filter>
21+
<whitelist addUncoveredFilesFromWhitelist="true">
22+
<directory suffix=".php">./src</directory>
23+
</whitelist>
24+
</filter>
25+
</phpunit>

tests/PostgresErrorTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Sunaoka\PostgresError\Tests;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use Sunaoka\PostgresError\PostgresError;
7+
8+
class PostgresErrorTest extends TestCase
9+
{
10+
public function test()
11+
{
12+
self::assertSame('00000', PostgresError::SUCCESSFUL_COMPLETION);
13+
}
14+
}

0 commit comments

Comments
 (0)