Skip to content
Open
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
20 changes: 4 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
strategy:
matrix:
php-version:
- 8.1
- 8.2
- 8.3
- 8.4
Expand Down Expand Up @@ -54,7 +53,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
php-version: "8.2"
tools: composer:v2

- name: Install dependencies
Expand All @@ -70,14 +69,12 @@ jobs:
strategy:
matrix:
include:
- php-version: '8.1'
typo3-version: '^12.4'
- php-version: '8.2'
typo3-version: '^12.4'
typo3-version: '^13.4'
- php-version: '8.3'
typo3-version: '^12.4'
typo3-version: '^13.4'
- php-version: '8.4'
typo3-version: '^12.4'
typo3-version: '^13.4'
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -109,9 +106,6 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Run Unit Tests PHP8.1
run: nix-shell --arg phpVersion \"php81\" --pure --run project-test-unit

- name: Run Unit Tests PHP8.2
run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-unit

Expand All @@ -121,9 +115,6 @@ jobs:
- name: Run Unit Tests PHP8.4
run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-unit

- name: Run Functional Tests PHP8.1
run: nix-shell --arg phpVersion \"php81\" --pure --run project-test-functional

- name: Run Functional Tests PHP8.2
run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-functional

Expand All @@ -144,9 +135,6 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Run Acceptance Tests PHP8.1
run: nix-shell --arg phpVersion \"php81\" --pure --run project-test-acceptance

- name: Run Acceptance Tests PHP8.2
run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-acceptance

Expand Down
25 changes: 4 additions & 21 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cache:
- .php_cs.cache

variables:
TYPO3_VERSION: ^12.4
TYPO3_VERSION: ^13.4

before_script:
- apk add git --update
Expand Down Expand Up @@ -39,11 +39,6 @@ lint:yaml:
script:
- find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l

lint:php81:
<<: *lint_php
variables:
CONTAINER_IMAGE: php:8.1-alpine

lint:php82:
<<: *lint_php
variables:
Expand All @@ -60,11 +55,11 @@ lint:php84:
CONTAINER_IMAGE: php:8.4-alpine

phpstan:analyse:
image: $CI_REGISTRY/containers/phpunit-with-php-8.1:main
image: $CI_REGISTRY/containers/phpunit-with-php-8.2:main
stage: lint
before_script:
- sed -i -e "s#ssh://git@code.extco.de:22722#https://gitlab-ci-token:$CI_JOB_TOKEN@code.extco.de#g" composer.json
- composer config platform.php 8.1
- composer config platform.php 8.2
- composer install --no-progress --no-ansi --no-interaction
script:
- vendor/bin/codecept build
Expand All @@ -83,12 +78,7 @@ phpstan:analyse:
- composer require typo3/cms-core="${TYPO3_VERSION}"
script:
- vendor/bin/phpunit -c Build/UnitTests.xml
- typo3DatabaseDriver=pdo_sqlite vendor/bin/phpunit -c Build/FunctionalTests.xml

test:php81:
<<: *test_php
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.1:main
- typo3DatabaseDriver=pdo_sqlite vendor/bin/phpunit -d memory_limit=256M -c Build/FunctionalTests.xml

test:php82:
<<: *test_php
Expand Down Expand Up @@ -129,15 +119,8 @@ test:php84:
expire_in: 1 day
when: always

codeception:php81:
<<: *test_codeception
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/codeception-with-php-8.1:main

codeception:php82:
<<: *test_codeception
needs:
- codeception:php81
variables:
CONTAINER_IMAGE: $CI_REGISTRY/containers/codeception-with-php-8.2:main

Expand Down
43 changes: 11 additions & 32 deletions Classes/Controller/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Http\ForwardResponse;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface;

class EventController extends ActionController
final class EventController extends ActionController
{
private Cart $cart;

Expand Down Expand Up @@ -118,6 +117,10 @@ public function showAction(?Event $event = null): ResponseInterface
#[IgnoreValidation(['value' => 'priceCategory'])]
public function formAction(?EventDate $eventDate = null, ?PriceCategory $priceCategory = null): ResponseInterface
{
if (class_exists(\TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface::class) === false) {
throw new \BadFunctionCallException('This action requires the installation of typo3/cms-form.');
}

if (!$eventDate) {
$arguments = $this->request->getArguments();
foreach ($arguments as $argumentKey => $argumentValue) {
Expand All @@ -133,7 +136,7 @@ public function formAction(?EventDate $eventDate = null, ?PriceCategory $priceCa

$formDefinition = $eventDate->getEvent()->getFormDefinition();
$formPersistenceManager = GeneralUtility::makeInstance(
FormPersistenceManagerInterface::class
\TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface::class
);
$form = $formPersistenceManager->load($formDefinition);

Expand Down Expand Up @@ -195,28 +198,7 @@ public function formAction(?EventDate $eventDate = null, ?PriceCategory $priceCa
return $this->htmlResponse();
}

protected function getEvent(): ?Event
{
$eventUid = 0;

if ((int)$GLOBALS['TSFE']->page['doktype'] == 186) {
$eventUid = (int)$GLOBALS['TSFE']->page['cart_events_event'];
}

if ($eventUid > 0) {
$event = $this->eventRepository->findByUid($eventUid);
if ($event && $event instanceof Event) {
return $event;
}
}

return null;
}

/**
* Create the demand object which define which records will get shown
*/
protected function createDemandObjectFromSettings(string $type, array $settings): EventDemand
private function createDemandObjectFromSettings(string $type, array $settings): EventDemand
{
/** @var EventDemand $demand */
$demand = GeneralUtility::makeInstance(
Expand Down Expand Up @@ -254,7 +236,7 @@ protected function createDemandObjectFromSettings(string $type, array $settings)
return $demand;
}

protected function addCategoriesToDemandObjectFromSettings(EventDemand &$demand): void
private function addCategoriesToDemandObjectFromSettings(EventDemand &$demand): void
{
if ($this->settings['categoriesList']) {
$selectedCategories = GeneralUtility::intExplode(
Expand All @@ -281,10 +263,7 @@ protected function addCategoriesToDemandObjectFromSettings(EventDemand &$demand)
}
}

/**
* assigns currency translation array to view
*/
protected function assignCurrencyTranslationData(): void
private function assignCurrencyTranslationData(): void
{
$this->restoreSession();

Expand All @@ -297,7 +276,7 @@ protected function assignCurrencyTranslationData(): void
$this->view->assign('currencyTranslationData', $currencyTranslationData);
}

protected function addCacheTags(iterable $events): void
private function addCacheTags(iterable $events): void
{
$cacheTags = [];

Expand Down Expand Up @@ -333,7 +312,7 @@ private function forwardToShowActionWhenRequested(): ?ForwardResponse
return $forwardResponse->withArguments(['event' => $this->request->getArgument('event')]);
}

protected function restoreSession(): void
private function restoreSession(): void
{
$cart = $this->sessionHandler->restoreCart($this->cartConfiguration['settings']['cart']['pid']);

Expand Down
3 changes: 2 additions & 1 deletion Classes/Controller/EventDateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

use Extcode\CartEvents\Domain\Repository\EventDateRepository;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class EventDateController extends ActionController
final class EventDateController extends ActionController
{
public function __construct(
private readonly EventDateRepository $eventDateRepository,
Expand Down
13 changes: 7 additions & 6 deletions Classes/Domain/Model/AbstractEventDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,33 @@
* LICENSE file that was distributed with this source code.
*/

use DateTime;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

abstract class AbstractEventDate extends AbstractEntity
{
protected ?\DateTime $begin = null;
protected ?DateTime $begin = null;

protected ?\DateTime $end = null;
protected ?DateTime $end = null;

protected string $note = '';

public function getBegin(): ?\DateTime
public function getBegin(): ?DateTime
{
return $this->begin;
}

public function setBegin(\DateTime $begin): void
public function setBegin(DateTime $begin): void
{
$this->begin = $begin;
}

public function getEnd(): ?\DateTime
public function getEnd(): ?DateTime
{
return $this->end;
}

public function setEnd(\DateTime $end): void
public function setEnd(DateTime $end): void
{
$this->end = $end;
}
Expand Down
Loading