Skip to content

Commit

Permalink
Merge pull request #125 from derhansen/feature/typo3-11
Browse files Browse the repository at this point in the history
[!!!][TASK] TYPO3 11.5 compatible version
  • Loading branch information
derhansen authored Dec 16, 2021
2 parents 1ed9e4b + 9d2fafd commit fa969b5
Show file tree
Hide file tree
Showing 36 changed files with 659 additions and 518 deletions.
27 changes: 9 additions & 18 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
name: Unit tests

on:
push:
branches:
- 'master'
tags:
- '*'
pull_request:
on: [push, pull_request]

jobs:
build:
strategy:
matrix:
php: ['7.2', '7.3', '7.4']
typo3: ['^10.4']
php: ['7.4', '8.0', '8.1']
typo3: ['^11.5']
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.php == '8.0' }}
name: PHP ${{ matrix.php }}, TYPO3 ${{ matrix.typo3 }}

steps:
- uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@v1

- name: Set up PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, json
coverage: pcov
tools: composer:v2

- name: Validate composer.json and composer.lock
Expand All @@ -40,7 +31,7 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run unit tests
run: vendor/bin/phpunit --colors -c vendor/nimut/testing-framework/res/Configuration/UnitTests.xml Tests/Unit/
run: .Build/bin/phpunit --colors -c Tests/Build/UnitTests.xml

- name: Run PHP lint
run: find . -name \*.php ! -path "./public/*" ! -path "./vendor/*" | xargs -n1 php -d display_errors=stderr -l
run: find . -name \*.php ! -path "./.Build/*" ! -path "./public/*" ! -path "./vendor/*" | xargs -n1 php -d display_errors=stderr -l
45 changes: 0 additions & 45 deletions .github/workflows/release.yml

This file was deleted.

6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
.idea

# Local files
.Build
.php-cs-fixer.cache
.phpunit.result.cache

/var/
/public/
/vendor/
/Resources/Private/Libraries/vendor
data
composer.lock
composer.lock
69 changes: 69 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

$header = <<<'EOF'
This file is part of the TYPO3 extension web2pdf.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

return (new \PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'braces' => ['allow_single_line_closure' => true],
'cast_spaces' => ['space' => 'none'],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'function_typehint_space' => true,
'lowercase_cast' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'modernize_types_casting' => true,
'native_function_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'single_quote' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],
'single_trait_insert_per_statement' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'whitespace_after_comma_in_array' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude(['.Build', 'Documentation', 'Resources'])
->notName('ext_emconf.php')
);
6 changes: 4 additions & 2 deletions Build/package-version.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

if [ -n "${VERSION}" ] ; then
true # pass
elif [ -n "$1" ] ; then
VERSION="$1"
elif [ -n "${GITHUB_REF}" ] ; then
VERSION="${GITHUB_REF/refs\/tags\//}"
VERSION="${VERSION#v}"
Expand All @@ -21,7 +23,6 @@ composer install --no-dev

popd

sed -i -e "s,[0-9]\.[0-9]-dev,${VERSION},g" ext_emconf.php
zip -9 -r \
--exclude=Resources/Private/Libraries/vendor/mpdf/mpdf/ttfonts/* \
web2pdf_${VERSION}.zip \
Expand All @@ -33,4 +34,5 @@ zip -9 -r \
ext_icon.png \
ext_localconf.php \
LICENSE.txt \
README.md \
README.md \
composer.json \
15 changes: 3 additions & 12 deletions Classes/Controller/PdfController.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/* * *************************************************************
/****************************************************************
* Copyright notice
*
* (C) 2015 Mittwald CM Service GmbH & Co. KG <[email protected]>
* (C) Mittwald CM Service GmbH & Co. KG <[email protected]>
*
* All rights reserved
*
Expand All @@ -22,26 +22,17 @@
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
* ************************************************************* */
***************************************************************/

namespace Mittwald\Web2pdf\Controller;

use Mittwald\Web2pdf\Options\ModuleOptions;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

/**
* Controller provides partial view for pdf link
*
* @author Kevin Purrmann <[email protected]>, Purrmann Websolutions
* @package Mittwald
* @subpackage Web2Pdf\Controller
*/
class PdfController extends ActionController
{

/**
* Method provides link generation
*
*/
public function generatePdfLinkAction()
{
Expand Down
48 changes: 28 additions & 20 deletions Classes/Middleware/PdfHandler.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
<?php

/****************************************************************
* Copyright notice
*
* (C) Mittwald CM Service GmbH & Co. KG <[email protected]>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

namespace Mittwald\Web2pdf\Middleware;


use Mittwald\Web2pdf\Options\ModuleOptions;
use Mittwald\Web2pdf\View\PdfView;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -15,24 +37,10 @@

class PdfHandler implements MiddlewareInterface
{
/**
* @var PdfView
*/
private $pdfView;
/**
* @var TypoScriptFrontendController
*/
private $frontendController;
/**
* @var ModuleOptions
*/
private $moduleOptions;
private PdfView $pdfView;
private TypoScriptFrontendController $frontendController;
private ModuleOptions $moduleOptions;

/**
* PdfHandler constructor.
* @param PdfView $pdfView
* @param ModuleOptions $moduleOptions
*/
public function __construct(PdfView $pdfView, ModuleOptions $moduleOptions)
{
$this->pdfView = $pdfView;
Expand Down Expand Up @@ -61,7 +69,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

$response = new Response();
$file = $this->pdfView->renderHtmlOutput($output->getBody(), $this->frontendController->generatePageTitle());
$destination = ($pdfDestination = $this->moduleOptions->getPdfDestination()) ? $pdfDestination : 'attachment';
$destination = $this->moduleOptions->getPdfDestination() ?? 'attachment';

$response = $response->withHeader('Content-Transfer-Encoding', 'binary');
$response->getBody()->write(file_get_contents($file));
Expand All @@ -70,4 +78,4 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

return $response->withStatus(200);
}
}
}
Loading

0 comments on commit fa969b5

Please sign in to comment.