Skip to content

Commit e38f515

Browse files
authored
Merge pull request #47 from Jurj-Bogdan/4.0
Added PHPUnit and tests, psalm and phpcs fixes
2 parents c72dd74 + 1772a7b commit e38f515

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1762
-922
lines changed

.github/workflows/codecov.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
on:
2+
- push
3+
4+
name: Run Codecov checks
5+
6+
jobs:
7+
code-coverage:
8+
name: Code Coverage
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
php:
18+
- "8.1"
19+
- "8.2"
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: "${{ matrix.php }}"
29+
coverage: pcov
30+
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
31+
tools: composer:v2, cs2pr
32+
33+
- name: Determine composer cache directory
34+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
35+
36+
- name: Cache dependencies installed with composer
37+
uses: actions/cache@v3
38+
with:
39+
path: ${{ env.COMPOSER_CACHE_DIR }}
40+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
41+
restore-keys: |
42+
php${{ matrix.php }}-composer-
43+
44+
- name: Install dependencies with composer
45+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
46+
47+
- name: Collect code coverage with PHPUnit
48+
run: vendor/bin/phpunit --colors=always --coverage-clover clover.xml
49+
50+
- name: Send code coverage report to Codecov.io
51+
uses: codecov/codecov-action@v3
52+
with:
53+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/cs-tests.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
- push
3+
4+
name: Run phpcs checks
5+
6+
jobs:
7+
mutation:
8+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
php:
18+
- "8.1"
19+
- "8.2"
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: "${{ matrix.php }}"
29+
tools: composer:v2, cs2pr
30+
coverage: none
31+
32+
- name: Determine composer cache directory
33+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
34+
35+
- name: Cache dependencies installed with composer
36+
uses: actions/cache@v3
37+
with:
38+
path: ${{ env.COMPOSER_CACHE_DIR }}
39+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
40+
restore-keys: |
41+
php${{ matrix.php }}-composer-
42+
- name: Install dependencies with composer
43+
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
44+
45+
- name: Run phpcs checks
46+
run: vendor/bin/phpcs
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
- push
3+
4+
name: Run static analysis
5+
6+
jobs:
7+
mutation:
8+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
php:
18+
- "8.1"
19+
- "8.2"
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: "${{ matrix.php }}"
29+
tools: composer:v2, cs2pr
30+
coverage: none
31+
32+
- name: Determine composer cache directory
33+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
34+
35+
- name: Cache dependencies installed with composer
36+
uses: actions/cache@v3
37+
with:
38+
path: ${{ env.COMPOSER_CACHE_DIR }}
39+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
40+
restore-keys: |
41+
php${{ matrix.php }}-composer-
42+
- name: Install dependencies with composer
43+
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
44+
45+
- name: Run static analysis
46+
run: vendor/bin/psalm --no-cache --output-format=github --show-info=false --threads=4

.github/workflows/unit-tests.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
- push
3+
4+
name: Run PHPUnit tests
5+
6+
jobs:
7+
mutation:
8+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
php:
18+
- "8.1"
19+
- "8.2"
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: "${{ matrix.php }}"
29+
tools: composer:v2, cs2pr
30+
coverage: none
31+
32+
- name: Determine composer cache directory
33+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
34+
35+
- name: Cache dependencies installed with composer
36+
uses: actions/cache@v3
37+
with:
38+
path: ${{ env.COMPOSER_CACHE_DIR }}
39+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
40+
restore-keys: |
41+
php${{ matrix.php }}-composer-
42+
43+
- name: Install dependencies with composer
44+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
45+
46+
- name: Run PHPUnit tests
47+
run: vendor/bin/phpunit --colors=always

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
# User-specific stuff:
77
.idea
8+
.phpunit.result.cache
9+
.phpcs-cache
810

911
## File-based project format:
1012
*.iws

OSSMETADATA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
osslifecycle=active
1+
osslifecycle=active

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ DotKernel mail component based on [laminas-mail](https://github.com/laminas/lami
44

55

66
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-mail)
7-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/4.0.0)
7+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/4.1.0)
88

99
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/issues)
1010
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/network)
1111
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/stargazers)
1212
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/4.0/LICENSE.md)
1313

14+
[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml)
15+
16+
[![SymfonyInsight](https://insight.symfony.com/projects/1995ea7c-3b34-4eee-ac48-3571860d0307/big.svg)](https://insight.symfony.com/projects/1995ea7c-3b34-4eee-ac48-3571860d0307)
17+
18+
1419
### Configuration
1520

1621
#### Mail - Sendmail

composer.json

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,25 @@
1919
"email": "team@dotkernel.com"
2020
}
2121
],
22+
"config": {
23+
"sort-packages": true,
24+
"allow-plugins": {
25+
"dealerdirect/phpcodesniffer-composer-installer": true
26+
}
27+
},
2228
"require": {
23-
"php": "~8.0.0 || ~8.1.0",
29+
"php": "~8.1.0 || ~8.2.0",
30+
"ext-fileinfo": "*",
2431
"ext-json": "*",
2532
"laminas/laminas-servicemanager": "^3.16.0",
2633
"laminas/laminas-mail": "^2.17.0",
2734
"dotkernel/dot-event": "^3.2.0"
2835
},
2936
"require-dev": {
30-
"phpunit/phpunit": "^9.5.21",
31-
"squizlabs/php_codesniffer": "^3.7.1"
37+
"laminas/laminas-coding-standard": "^2.5",
38+
"mikey179/vfsstream": "^1.6",
39+
"phpunit/phpunit": "^10.2.6",
40+
"vimeo/psalm": "^5.13.1"
3241
},
3342
"autoload": {
3443
"psr-4": {
@@ -39,5 +48,16 @@
3948
"psr-4": {
4049
"DotTest\\Mail\\": "test/"
4150
}
51+
},
52+
"scripts": {
53+
"check": [
54+
"@cs-check",
55+
"@test"
56+
],
57+
"cs-check": "phpcs",
58+
"cs-fix": "phpcbf",
59+
"test": "phpunit --colors=always",
60+
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
61+
"static-analysis": "psalm --shepherd --stats"
4262
}
4363
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ return [
9393
'port' => 587,
9494

9595
//connection class used for authentication
96-
//the calue can be one of smtp, plain, login or crammd5
96+
//the value can be one of smtp, plain, login or crammd5
9797
'connection_class' => 'login',
9898

9999
'connection_config' => [

phpcs.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
4+
5+
<arg name="basepath" value="."/>
6+
<arg name="cache" value=".phpcs-cache"/>
7+
<arg name="colors"/>
8+
<arg name="extensions" value="php"/>
9+
<arg name="parallel" value="80"/>
10+
11+
<!-- Show progress -->
12+
<arg value="p"/>
13+
14+
<!-- Paths to check -->
15+
<file>src</file>
16+
<file>test</file>
17+
18+
<!-- Include all rules from the Laminas Coding Standard -->
19+
<rule ref="LaminasCodingStandard"/>
20+
</ruleset>

0 commit comments

Comments
 (0)