Skip to content

Commit 42e8a75

Browse files
authored
REFACTOR PHP 8 PHPUnit 9 support (#10)
1 parent cd616c8 commit 42e8a75

File tree

4 files changed

+21
-52
lines changed

4 files changed

+21
-52
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ jobs:
3232
fail-fast: false
3333
matrix:
3434
php-version:
35-
- "7.3"
3635
- "7.4"
36+
- "8.0"
37+
- "8.1"
3738

3839
steps:
3940
- name: "Checkout"
@@ -56,48 +57,19 @@ jobs:
5657
key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}"
5758
restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
5859

59-
- name: "Authorize private packagist"
60-
env:
61-
COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }}
62-
run: "if [[ $COMPOSER_TOKEN ]]; then composer config --global --auth http-basic.repo.packagist.com token $COMPOSER_TOKEN; fi"
63-
6460
- name: "Install dependencies with composer"
6561
run: "composer install --no-ansi --no-interaction --no-progress"
6662

6763
- name: "Run tests with phpunit/phpunit"
6864
env:
6965
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
70-
run: "vendor/bin/phpunit --coverage-html=build/logs/coverage/html --coverage-xml=build/logs/coverage"
66+
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
7167

72-
- name: "Archive code coverage results"
73-
uses: "actions/upload-artifact@v2"
68+
- name: "Upload coverage results to CodeCov"
69+
uses: codecov/codecov-action@v1
7470
with:
75-
name: "coverage"
76-
path: "build/logs/coverage/html"
71+
files: ./coverage.xml # optional
72+
flags: unittests # optional
7773

7874
- name: "Run tests with squizlabs/php_codesniffer"
79-
run: "vendor/bin/phpcs src/ tests/ --standard=phpcs.xml.dist --report=checkstyle --report-file=build/logs/checkstyle.xml"
80-
81-
- name: "Archive checkstyle results"
82-
uses: "actions/upload-artifact@v2"
83-
with:
84-
name: "checkstyle"
85-
path: "build/logs/checkstyle.xml"
86-
87-
#- name: "Run tests with phpmd/phpmd"
88-
# run: "vendor/bin/phpmd src xml codesize,unusedcode,naming --reportfile build/logs/pmd.xml --exclude vendor/ --exclude autoload.php"
89-
90-
- name: "Run tests with phploc/phploc"
91-
run: "vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml src/ tests/
92-
"
93-
- name: "Run tests with pdepend/pdepend"
94-
run: "vendor/bin/pdepend --jdepend-xml=build/logs/jdepend.xml --ignore=vendor src"
95-
96-
- name: "Publish documentation"
97-
run: "vendor/bin/phpdox -f phpdox.xml"
98-
99-
- name: "Archive documentation"
100-
uses: "actions/upload-artifact@v2"
101-
with:
102-
name: "documentation"
103-
path: "docs/html"
75+
run: "vendor/bin/phpcs -s --report=summary --standard=phpcs.xml.dist --extensions=php,inc --ignore=autoload.php --ignore=vendor/ src/ tests/"

composer.json

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"name": "Dynamic",
77
"email": "dev@dynamicagency.com",
8-
"homepage": "http://www.dynamicagency.com"
8+
"homepage": "https://www.dynamicagency.com"
99
}
1010
],
1111
"keywords": [
@@ -14,33 +14,30 @@
1414
"type": "silverstripe-vendormodule",
1515
"license": "BSD-3-Clause",
1616
"require": {
17-
"dnadesign/silverstripe-elemental": "^4.0",
18-
"silverstripe/recipe-cms": "^4.4",
19-
"silverstripe/vendor-plugin": "^1.0"
17+
"dnadesign/silverstripe-elemental": "^4.8"
2018
},
2119
"require-dev": {
22-
"pdepend/pdepend": "^2.5",
23-
"phploc/phploc": "^4.0",
24-
"phpmd/phpmd": "^2.6",
25-
"phpunit/phpunit": "^5.7",
26-
"sebastian/phpcpd": "^3.0",
27-
"squizlabs/php_codesniffer": "^3.0",
28-
"theseer/phpdox": "^0.11"
29-
},
30-
"config": {
31-
"process-timeout": 600
20+
"silverstripe/recipe-testing": "^2",
21+
"squizlabs/php_codesniffer": "^3.0"
3222
},
3323
"autoload": {
3424
"psr-4": {
3525
"Dynamic\\Elements\\Embedded\\": "src/",
3626
"Dynamic\\Elements\\Embedded\\Tests\\": "tests/"
3727
}
3828
},
29+
"config": {
30+
"process-timeout": 600
31+
},
3932
"minimum-stability": "dev",
4033
"prefer-stable": true,
4134
"extra": {
4235
"branch-alias": {
4336
"dev-master": "2.x-dev"
4437
}
38+
},
39+
"scripts": {
40+
"lint": "vendor/bin/phpcs src/ tests/",
41+
"lint-clean": "vendor/bin/phpcbf src/ tests/"
4542
}
4643
}

tests/Elements/ElementEmbeddedCodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ElementEmbeddedCodeTest extends SapphireTest
1515
/**
1616
* @var string
1717
*/
18-
protected static $fixture_file = '../fixtures.yml';
18+
protected static $fixture_file = 'element-embedded-code.yml';
1919

2020
/**
2121
*
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Dynamic\Elements\Embedded\Elements\ElementEmbeddedCode:
22
one:
3-
Title: "Embedded Code One"
3+
Title: "Embedded Code One"

0 commit comments

Comments
 (0)