mirror of
https://github.com/werkraum-media/events.git
synced 2024-12-22 07:46:08 +01:00
Improve automated testing (#15)
Use abstract classes to include necessary steps and keep actual test cases small. Ensure tests in CI run faster but not installing unnecessary dependencies. But use pre installed ImageMagick.
This commit is contained in:
parent
17ecfb12c1
commit
9bc0466e5d
9 changed files with 114 additions and 32 deletions
3
.github/workflows/ci.yaml
vendored
3
.github/workflows/ci.yaml
vendored
|
@ -148,9 +148,6 @@ jobs:
|
|||
php-version: "${{ matrix.php-version }}"
|
||||
tools: composer:v2
|
||||
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get install graphicsmagick
|
||||
|
||||
- name: Install dependencies with expected TYPO3 version
|
||||
run: composer require --no-interaction --prefer-dist --no-progress "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}" "typo3/cms-fluid:${{ matrix.typo3-version }}" "typo3/cms-filelist:${{ matrix.typo3-version }}" "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-fluid-styled-content:${{ matrix.typo3-version }}"
|
||||
|
||||
|
|
47
Tests/Functional/AbstractFunctionalTestCase.php
Normal file
47
Tests/Functional/AbstractFunctionalTestCase.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Copyright (C) 2023 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
namespace Wrm\Events\Tests\Functional;
|
||||
|
||||
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||
|
||||
abstract class AbstractFunctionalTestCase extends FunctionalTestCase
|
||||
{
|
||||
use TestingFramework;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
ArrayUtility::mergeRecursiveWithOverrule($this->configurationToUseInTestInstance, [
|
||||
'GFX' => [
|
||||
'processor_enabled' => true,
|
||||
'processor_path' => '/usr/bin/',
|
||||
'processor_path_lzw' => '/usr/bin/',
|
||||
'processor' => 'ImageMagick',
|
||||
],
|
||||
]);
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
}
|
|
@ -2,20 +2,17 @@
|
|||
|
||||
namespace Wrm\Events\Tests\Functional\Cleanup;
|
||||
|
||||
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||
use Wrm\Events\Command\RemoveAllCommand;
|
||||
use Wrm\Events\Tests\Functional\AbstractFunctionalTestCase;
|
||||
|
||||
/**
|
||||
* @testdox Cleanup RemoveAll
|
||||
*/
|
||||
class RemoveAllTest extends FunctionalTestCase
|
||||
class RemoveAllTest extends AbstractFunctionalTestCase
|
||||
{
|
||||
use TestingFramework;
|
||||
|
||||
protected $testExtensionsToLoad = [
|
||||
'typo3conf/ext/events',
|
||||
];
|
||||
|
|
|
@ -2,20 +2,17 @@
|
|||
|
||||
namespace Wrm\Events\Tests\Functional\Cleanup;
|
||||
|
||||
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||
use Wrm\Events\Command\RemovePastCommand;
|
||||
use Wrm\Events\Tests\Functional\AbstractFunctionalTestCase;
|
||||
|
||||
/**
|
||||
* @testdox Cleanup RemovePast
|
||||
*/
|
||||
class RemovePastTest extends FunctionalTestCase
|
||||
class RemovePastTest extends AbstractFunctionalTestCase
|
||||
{
|
||||
use TestingFramework;
|
||||
|
||||
protected $testExtensionsToLoad = [
|
||||
'typo3conf/ext/events',
|
||||
];
|
||||
|
|
53
Tests/Functional/Frontend/AbstractTestCase.php
Normal file
53
Tests/Functional/Frontend/AbstractTestCase.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Copyright (C) 2023 Daniel Siepmann <coding@daniel-siepmann.de>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
namespace Wrm\Events\Tests\Functional\Frontend;
|
||||
|
||||
use TYPO3\CMS\Core\TypoScript\TemplateService;
|
||||
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
||||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Hook\TypoScriptInstructionModifier;
|
||||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\TypoScriptInstruction;
|
||||
use Wrm\Events\Tests\Functional\AbstractFunctionalTestCase;
|
||||
|
||||
abstract class AbstractTestCase extends AbstractFunctionalTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
ArrayUtility::mergeRecursiveWithOverrule($this->configurationToUseInTestInstance, [
|
||||
'SC_OPTIONS' => [
|
||||
'Core/TypoScript/TemplateService' => [
|
||||
'runThroughTemplatesPostProcessing' => [
|
||||
'FunctionalTest' => TypoScriptInstructionModifier::class . '->apply',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
protected function getTypoScriptInstruction(): TypoScriptInstruction
|
||||
{
|
||||
return new TypoScriptInstruction(TemplateService::class);
|
||||
}
|
||||
}
|
|
@ -29,12 +29,12 @@ use DateTimeImmutable;
|
|||
use DateTimeZone;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
|
||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||
use Wrm\Events\Tests\Functional\AbstractFunctionalTestCase;
|
||||
|
||||
/**
|
||||
* @covers \Wrm\Events\Caching\PageCacheTimeout
|
||||
*/
|
||||
class CacheTest extends FunctionalTestCase
|
||||
class CacheTest extends AbstractFunctionalTestCase
|
||||
{
|
||||
use TestingFramework;
|
||||
|
||||
|
|
|
@ -23,18 +23,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace Wrm\Events\Tests\Functional\Frontend;
|
||||
|
||||
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
|
||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||
use Wrm\Events\Frontend\Daest;
|
||||
use Wrm\Events\Frontend\Dates;
|
||||
use Wrm\Events\Tests\Functional\AbstractFunctionalTestCase;
|
||||
|
||||
/**
|
||||
* @covers \Wrm\Events\Frontend\Daest
|
||||
* @covers \Wrm\Events\Frontend\Dates
|
||||
*/
|
||||
class DatesTest extends FunctionalTestCase
|
||||
class DatesTest extends AbstractFunctionalTestCase
|
||||
{
|
||||
use TestingFramework;
|
||||
|
||||
protected $testExtensionsToLoad = [
|
||||
'typo3conf/ext/events',
|
||||
];
|
||||
|
|
|
@ -4,18 +4,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace Wrm\Events\Tests\Functional\Frontend;
|
||||
|
||||
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
|
||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||
use Wrm\Events\Tests\Functional\AbstractFunctionalTestCase;
|
||||
|
||||
/**
|
||||
* @covers \Wrm\Events\Controller\DateController
|
||||
* @covers \Wrm\Events\Domain\Repository\DateRepository
|
||||
*/
|
||||
class FilterTest extends FunctionalTestCase
|
||||
class FilterTest extends AbstractFunctionalTestCase
|
||||
{
|
||||
use TestingFramework;
|
||||
|
||||
protected $testExtensionsToLoad = [
|
||||
'typo3conf/ext/events',
|
||||
];
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Wrm\Events\Tests\Functional\Import\DestinationDataTest;
|
||||
|
||||
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||
use GuzzleHttp\ClientInterface as GuzzleClientInterface;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
@ -11,14 +10,12 @@ use Symfony\Component\DependencyInjection\Container;
|
|||
use TYPO3\CMS\Core\Context\Context;
|
||||
use TYPO3\CMS\Core\Context\DateTimeAspect;
|
||||
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||
use Wrm\Events\Command\ImportDestinationDataViaConfigruationCommand;
|
||||
use Wrm\Events\Tests\ClientFactory;
|
||||
use Wrm\Events\Tests\Functional\AbstractFunctionalTestCase;
|
||||
|
||||
abstract class AbstractTest extends FunctionalTestCase
|
||||
abstract class AbstractTest extends AbstractFunctionalTestCase
|
||||
{
|
||||
use TestingFramework;
|
||||
|
||||
protected $coreExtensionsToLoad = [
|
||||
'filelist',
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue