Skip to content

Commit e325cff

Browse files
committed
CI: Added ODFValidator
1 parent e7fa00f commit e325cff

29 files changed

+450
-252
lines changed

.github/workflows/validator.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Validator
2+
on: [push, pull_request]
3+
jobs:
4+
odf:
5+
name: ODF Validator
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Setup PHP
9+
uses: shivammathur/setup-php@v2
10+
with:
11+
php-version: '8.4'
12+
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
13+
- uses: actions/checkout@v2
14+
15+
- name: Composer Install
16+
run: composer install --ansi --prefer-dist --no-interaction --no-progress
17+
18+
- name: Generate samples files
19+
run: composer run samples
20+
21+
- name: Download ODFValidator
22+
run: wget https://repo1.maven.org/maven2/org/odftoolkit/odfvalidator/0.12.0/odfvalidator-0.12.0-jar-with-dependencies.jar -O odfvalidator.jar
23+
24+
# https://odftoolkit.org/conformance/ODFValidator.html#what-is-checked
25+
- name: Validate documents (ODF 1.2)
26+
run: java -jar odfvalidator.jar -1.2 -e -r samples/results/ -x "^.*\/Sample_(04|22).*odp"
27+
## 04 & 22 excluded
28+
## Cause : src/PhpPresentation/Writer/ODPresentation/Content.php::writeTableStyle

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ php-cs-fixer.phar
1414
.phpunit.result.cache
1515
composer.phar
1616
vendor
17-
/batch_CI.bat
17+
/odfvalidator.jar
1818

1919
### Samples
2020
/samples/Sample_00_Test.php

docs/changes/1.2.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
- PowerPoint2007 Reader : Fixed loading of fonts by [@ag3202](https://github.com/ag3202) and [@Progi1984](https://github.com/Progi1984) in [#851](https://github.com/PHPOffice/PHPPresentation/pull/851)
2525

2626
## Miscellaneous
27+
- CI: Added ODFValidator by [@Progi1984](https://github.com/Progi1984) fixing [#678](https://github.com/PHPOffice/PHPWord/issues/678) in [#653](https://github.com/PHPOffice/PHPWord/pull/653)
2728

2829
## BC Breaks

phpstan.neon.dist

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ parameters:
2424
- '#^Parameter \#1 \$image of function imagesy expects GdImage, resource given\.#'
2525
- '#^Parameter \#1 \$image of function imagealphablending expects GdImage, resource given\.#'
2626
- '#^Parameter \#1 \$image of function imagesavealpha expects GdImage, resource given\.#'
27+
# # PHP 8.0 & Attribute
28+
- '#^Attribute class PHPUnit\\Framework\\Attributes\\DataProvider does not exist\.#'
2729

2830
## Remove after remove ArrayObject
2931
treatPhpDocTypesAsCertain: false

samples/Sample_03_Image.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535

3636
// Add a file drawing (GIF) to the slide
3737
$shape = new Drawing\File();
38-
$shape->setName('Image File')
38+
$shape
39+
->setName('Image File')
3940
->setDescription('Image File')
4041
->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif')
4142
->setHeight(36)

samples/Sample_Header.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,8 @@
108108

109109
/**
110110
* Write documents.
111-
*
112-
* @param PhpPresentation $phpPresentation
113-
* @param string $filename
114-
* @param array $writers
115-
*
116-
* @return string
117111
*/
118-
function write($phpPresentation, $filename, $writers)
112+
function write(PhpPresentation $phpPresentation, string $filename, array $writers): string
119113
{
120114
$result = '';
121115

0 commit comments

Comments
 (0)