Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#634 : Added ODFValidator #653

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Validator
on: [push, pull_request]
jobs:
odf:
name: ODF Validator
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@v2

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Generate samples files
run: composer run samples

- name: Download ODFValidator
run: wget https://repo1.maven.org/maven2/org/odftoolkit/odfvalidator/0.12.0/odfvalidator-0.12.0-jar-with-dependencies.jar -O odfvalidator.jar

# https://odftoolkit.org/conformance/ODFValidator.html#what-is-checked
- name: Validate documents (ODF 1.2)
run: java -jar odfvalidator.jar -1.2 -e -r samples/results/ -x "^.*\/Sample_(04|22).*odp"
## 04 & 22 excluded
## Cause : src/PhpPresentation/Writer/ODPresentation/Content.php::writeTableStyle
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ php-cs-fixer.phar
.phpunit.result.cache
composer.phar
vendor
/batch_CI.bat
/odfvalidator.jar

### Samples
/samples/Sample_00_Test.php
Expand Down
1 change: 1 addition & 0 deletions docs/changes/1.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
- 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)

## Miscellaneous
- 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)

## BC Breaks
2 changes: 2 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ parameters:
- '#^Parameter \#1 \$image of function imagesy expects GdImage, resource given\.#'
- '#^Parameter \#1 \$image of function imagealphablending expects GdImage, resource given\.#'
- '#^Parameter \#1 \$image of function imagesavealpha expects GdImage, resource given\.#'
# # PHP 8.0 & Attribute
- '#^Attribute class PHPUnit\\Framework\\Attributes\\DataProvider does not exist\.#'

## Remove after remove ArrayObject
treatPhpDocTypesAsCertain: false
3 changes: 2 additions & 1 deletion samples/Sample_03_Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@

// Add a file drawing (GIF) to the slide
$shape = new Drawing\File();
$shape->setName('Image File')
$shape
->setName('Image File')
->setDescription('Image File')
->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif')
->setHeight(36)
Expand Down
8 changes: 1 addition & 7 deletions samples/Sample_Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,8 @@

/**
* Write documents.
*
* @param PhpPresentation $phpPresentation
* @param string $filename
* @param array $writers
*
* @return string
*/
function write($phpPresentation, $filename, $writers)
function write(PhpPresentation $phpPresentation, string $filename, array $writers): string
{
$result = '';

Expand Down
Loading