mirror of
https://github.com/werkraum-media/calendar.git
synced 2024-12-06 14:56:10 +01:00
Add TYPO3 v11 and PHP 8.x compatibility (#6)
This commit is contained in:
parent
f1d9466045
commit
03320171ce
10 changed files with 95 additions and 102 deletions
65
.github/workflows/ci.yaml
vendored
65
.github/workflows/ci.yaml
vendored
|
@ -6,6 +6,12 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
coverage: none
|
||||
tools: composer:v2
|
||||
|
||||
- name: Validate composer.json
|
||||
run: composer validate
|
||||
|
||||
|
@ -16,6 +22,9 @@ jobs:
|
|||
php-version:
|
||||
- 7.3
|
||||
- 7.4
|
||||
- 8.0
|
||||
- 8.1
|
||||
- 8.2
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
@ -23,31 +32,12 @@ jobs:
|
|||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
coverage: none
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
|
||||
- name: PHP lint
|
||||
run: "find *.php Classes Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l"
|
||||
|
||||
check-dependencies:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [check-composer]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "7.3"
|
||||
|
||||
- name: Keep composer at 1.x
|
||||
run: sudo composer selfupdate --1
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --no-suggest --no-plugins
|
||||
|
||||
- name: Missing composer requirements
|
||||
run: ./vendor/bin/composer-require-checker check
|
||||
|
||||
xml-linting:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [check-composer]
|
||||
|
@ -57,14 +47,13 @@ jobs:
|
|||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "7.3"
|
||||
php-version: "8.2"
|
||||
coverage: none
|
||||
tools: composer:v2
|
||||
|
||||
- name: Install xmllint
|
||||
run: sudo apt-get install libxml2-utils
|
||||
|
||||
- name: Keep composer at 1.x
|
||||
run: sudo composer selfupdate --1
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --no-suggest
|
||||
|
||||
|
@ -80,7 +69,6 @@ jobs:
|
|||
coding-guideline:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- check-dependencies
|
||||
- xml-linting
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -88,10 +76,9 @@ jobs:
|
|||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "7.3"
|
||||
|
||||
- name: Keep composer at 1.x
|
||||
run: sudo composer selfupdate --1
|
||||
coverage: none
|
||||
tools: composer:v2
|
||||
php-version: "8.2"
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --no-suggest
|
||||
|
@ -102,24 +89,30 @@ jobs:
|
|||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- check-dependencies
|
||||
- xml-linting
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- 7.3
|
||||
- 7.4
|
||||
include:
|
||||
- php-version: '7.3'
|
||||
typo3-version: '^10.4'
|
||||
- php-version: '7.4'
|
||||
typo3-version: '^10.4'
|
||||
- php-version: '7.4'
|
||||
typo3-version: '^11.5'
|
||||
- php-version: '8.1'
|
||||
typo3-version: '^11.5'
|
||||
- php-version: '8.2'
|
||||
typo3-version: '^11.5'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
coverage: none
|
||||
tools: composer:v2
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
|
||||
- name: Keep composer at 1.x
|
||||
run: sudo composer selfupdate --1
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress --no-suggest
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ Nothing
|
|||
Features
|
||||
--------
|
||||
|
||||
* Add compatibility for TYPO3 v11 and PHP 8.0, 8.1, 8.2.
|
||||
|
||||
* Add context to foreign data factory.
|
||||
The factory can optionally implement the ``WerkraumMedia\Calendar\Domain\Model\ContextSpecificFactory`` interface.
|
||||
That way it will receive a bit of context to react on the current situation.
|
||||
|
|
12
README.rst
12
README.rst
|
@ -3,13 +3,21 @@ TYPO3 Extension: calendar
|
|||
|
||||
Provides:
|
||||
|
||||
* Data (classes) for Month, Week and Day.
|
||||
* Data (classes) for Year, Month, Week and Day.
|
||||
|
||||
* Controller with action to view Month, Week and Day.
|
||||
* Controller with action to view Year, Month, Week and Day.
|
||||
|
||||
Each day can have foreign data created by a factory.
|
||||
That way extensions or TYPO3 instances can add further data to each day.
|
||||
|
||||
Alter Variables
|
||||
---------------
|
||||
|
||||
The controller also has an event to alter assigned variables for each action.
|
||||
|
||||
Check out ``Tests/Fixtures/calendar_example/`` as an example on how to provide
|
||||
necessary custom setup.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||
namespace WerkraumMedia\Calendar\Tests\Unit\Domain\Model;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Context;
|
||||
|
||||
|
@ -33,15 +32,17 @@ use WerkraumMedia\Calendar\Domain\Model\Context;
|
|||
*/
|
||||
class ContextTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function canNotBeCreatedViaNew(): void
|
||||
{
|
||||
$this->expectError();
|
||||
$this->expectErrorMessage('Call to private WerkraumMedia\Calendar\Domain\Model\Context::__construct() from context \'WerkraumMedia\Calendar\Tests\Unit\Domain\Model\ContextTest\'');
|
||||
if (version_compare(PHP_VERSION, '8.0', '>=')) {
|
||||
$this->expectErrorMessage('Call to private WerkraumMedia\Calendar\Domain\Model\Context::__construct() from scope WerkraumMedia\Calendar\Tests\Unit\Domain\Model\ContextTest');
|
||||
} else {
|
||||
$this->expectErrorMessage('Call to private WerkraumMedia\Calendar\Domain\Model\Context::__construct() from context \'WerkraumMedia\Calendar\Tests\Unit\Domain\Model\ContextTest\'');
|
||||
}
|
||||
$subject = new Context();
|
||||
}
|
||||
|
||||
|
@ -50,8 +51,8 @@ class ContextTest extends TestCase
|
|||
*/
|
||||
public function canBeCreatedFromContentObjectRenderer(): void
|
||||
{
|
||||
$contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class);
|
||||
$subject = Context::createFromContentObjectRenderer($contentObjectRenderer->reveal());
|
||||
$contentObjectRenderer = $this->createStub(ContentObjectRenderer::class);
|
||||
$subject = Context::createFromContentObjectRenderer($contentObjectRenderer);
|
||||
|
||||
self::assertInstanceOf(Context::class, $subject);
|
||||
}
|
||||
|
@ -61,9 +62,9 @@ class ContextTest extends TestCase
|
|||
*/
|
||||
public function providesTableNameInheritedFromContentObjectRenderer(): void
|
||||
{
|
||||
$contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class);
|
||||
$contentObjectRenderer->getCurrentTable()->willReturn('tx_calendar_example_table');
|
||||
$subject = Context::createFromContentObjectRenderer($contentObjectRenderer->reveal());
|
||||
$contentObjectRenderer = $this->createStub(ContentObjectRenderer::class);
|
||||
$contentObjectRenderer->method('getCurrentTable')->willReturn('tx_calendar_example_table');
|
||||
$subject = Context::createFromContentObjectRenderer($contentObjectRenderer);
|
||||
|
||||
self::assertSame('tx_calendar_example_table', $subject->getTableName());
|
||||
}
|
||||
|
@ -73,12 +74,12 @@ class ContextTest extends TestCase
|
|||
*/
|
||||
public function providesDatabaseRowInheritedFromContentObjectRenderer(): void
|
||||
{
|
||||
$contentObjectRenderer = $this->prophesize(ContentObjectRenderer::class);
|
||||
$contentObjectRenderer = $this->createStub(ContentObjectRenderer::class);
|
||||
$contentObjectRenderer->data = [
|
||||
'uid' => 10,
|
||||
'pid' => 1,
|
||||
];
|
||||
$subject = Context::createFromContentObjectRenderer($contentObjectRenderer->reveal());
|
||||
$subject = Context::createFromContentObjectRenderer($contentObjectRenderer);
|
||||
|
||||
self::assertSame([
|
||||
'uid' => 10,
|
||||
|
|
|
@ -22,8 +22,6 @@ namespace WerkraumMedia\Calendar\Tests\Unit\Domain\Model;
|
|||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Day;
|
||||
|
@ -38,7 +36,6 @@ use WerkraumMedia\Calendar\Tests\ForcePropertyTrait;
|
|||
*/
|
||||
class DayTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
use ForcePropertyTrait;
|
||||
|
||||
public function tearDown(): void
|
||||
|
@ -127,11 +124,11 @@ class DayTest extends TestCase
|
|||
{
|
||||
$subject = new Day(new \DateTime('2020-10-19'));
|
||||
|
||||
$foreignData = $this->prophesize(IsDayActive::class);
|
||||
$foreignData->isActive(Argument::any())->willReturn(false);
|
||||
$foreignData = $this->createStub(IsDayActive::class);
|
||||
$foreignData->method('isActive')->willReturn(false);
|
||||
|
||||
$this->forceProperty($subject, 'initialized', true);
|
||||
$this->forceProperty($subject, 'foreignData', $foreignData->reveal());
|
||||
$this->forceProperty($subject, 'foreignData', $foreignData);
|
||||
|
||||
self::assertFalse($subject->isActive());
|
||||
}
|
||||
|
@ -143,13 +140,13 @@ class DayTest extends TestCase
|
|||
{
|
||||
$subject = new Day(new \DateTime('2020-10-19'));
|
||||
|
||||
$foreignData = $this->prophesize(IsDayActive::class);
|
||||
$foreignData->isActive(Argument::any())->willReturn(true);
|
||||
$foreignData = $this->createStub(IsDayActive::class);
|
||||
$foreignData->method('isActive')->willReturn(true);
|
||||
|
||||
$factory = $this->prophesize(ForeignDataFactory::class);
|
||||
$factory->getData($subject)->willReturn($foreignData->reveal());
|
||||
$factory = $this->createStub(ForeignDataFactory::class);
|
||||
$factory->method('getData')->willReturn($foreignData);
|
||||
|
||||
GeneralUtility::addInstance(ForeignDataFactory::class, $factory->reveal());
|
||||
GeneralUtility::addInstance(ForeignDataFactory::class, $factory);
|
||||
|
||||
self::assertTrue($subject->isActive());
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace WerkraumMedia\Calendar\Tests\Unit\Domain\Model;
|
|||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Month;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Week;
|
||||
use WerkraumMedia\Calendar\Tests\ForcePropertyTrait;
|
||||
|
@ -33,7 +32,6 @@ use WerkraumMedia\Calendar\Tests\ForcePropertyTrait;
|
|||
*/
|
||||
class MonthTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
use ForcePropertyTrait;
|
||||
|
||||
/**
|
||||
|
@ -194,9 +192,9 @@ class MonthTest extends TestCase
|
|||
{
|
||||
$subject = new Month(02, 2018);
|
||||
|
||||
$week = $this->prophesize(Week::class);
|
||||
$week->isActive()->willReturn(false);
|
||||
$weeks = [$week->reveal()];
|
||||
$week = $this->createStub(Week::class);
|
||||
$week->method('isActive')->willReturn(false);
|
||||
$weeks = [$week];
|
||||
$this->forceProperty($subject, 'weeks', $weeks);
|
||||
|
||||
self::assertFalse($subject->isActive());
|
||||
|
@ -209,11 +207,11 @@ class MonthTest extends TestCase
|
|||
{
|
||||
$subject = new Month(02, 2018);
|
||||
|
||||
$week = $this->prophesize(Week::class);
|
||||
$week->isActive()->willReturn(true);
|
||||
$week2 = $this->prophesize(Week::class);
|
||||
$week2->isActive()->willReturn(false);
|
||||
$weeks = [$week->reveal(), $week2->reveal()];
|
||||
$week = $this->createStub(Week::class);
|
||||
$week->method('isActive')->willReturn(true);
|
||||
$week2 = $this->createStub(Week::class);
|
||||
$week2->method('isActive')->willReturn(false);
|
||||
$weeks = [$week, $week2];
|
||||
$this->forceProperty($subject, 'weeks', $weeks);
|
||||
|
||||
self::assertTrue($subject->isActive());
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace WerkraumMedia\Calendar\Tests\Unit\Domain\Model;
|
|||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Day;
|
||||
use WerkraumMedia\Calendar\Domain\Model\NullDataFactory;
|
||||
|
||||
|
@ -31,15 +30,13 @@ use WerkraumMedia\Calendar\Domain\Model\NullDataFactory;
|
|||
*/
|
||||
class NullDataFactoryTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function returnsNull(): void
|
||||
{
|
||||
$subject = new NullDataFactory();
|
||||
$day = $this->prophesize(Day::class);
|
||||
self::assertNull($subject->getData($day->reveal()));
|
||||
$day = $this->createStub(Day::class);
|
||||
self::assertNull($subject->getData($day));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace WerkraumMedia\Calendar\Tests\Unit\Domain\Model;
|
|||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Day;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Week;
|
||||
use WerkraumMedia\Calendar\Tests\ForcePropertyTrait;
|
||||
|
@ -33,7 +32,6 @@ use WerkraumMedia\Calendar\Tests\ForcePropertyTrait;
|
|||
*/
|
||||
class WeekTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
use ForcePropertyTrait;
|
||||
|
||||
/**
|
||||
|
@ -208,9 +206,9 @@ class WeekTest extends TestCase
|
|||
{
|
||||
$subject = new Week(02, 2018);
|
||||
|
||||
$day = $this->prophesize(Day::class);
|
||||
$day->isActive()->willReturn(false);
|
||||
$days = [$day->reveal()];
|
||||
$day = $this->createStub(Day::class);
|
||||
$day->method('isActive')->willReturn(false);
|
||||
$days = [$day];
|
||||
$this->forceProperty($subject, 'days', $days);
|
||||
|
||||
self::assertFalse($subject->isActive());
|
||||
|
@ -223,11 +221,11 @@ class WeekTest extends TestCase
|
|||
{
|
||||
$subject = new Week(02, 2018);
|
||||
|
||||
$day = $this->prophesize(Day::class);
|
||||
$day->isActive()->willReturn(true);
|
||||
$day2 = $this->prophesize(Day::class);
|
||||
$day2->isActive()->willReturn(false);
|
||||
$days = [$day->reveal(), $day2->reveal()];
|
||||
$day = $this->createStub(Day::class);
|
||||
$day->method('isActive')->willReturn(true);
|
||||
$day2 = $this->createStub(Day::class);
|
||||
$day2->method('isActive')->willReturn(false);
|
||||
$days = [$day, $day2];
|
||||
$this->forceProperty($subject, 'days', $days);
|
||||
|
||||
self::assertTrue($subject->isActive());
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace WerkraumMedia\Calendar\Tests\Unit\Domain\Model;
|
|||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Month;
|
||||
use WerkraumMedia\Calendar\Domain\Model\Year;
|
||||
use WerkraumMedia\Calendar\Tests\ForcePropertyTrait;
|
||||
|
@ -33,7 +32,6 @@ use WerkraumMedia\Calendar\Tests\ForcePropertyTrait;
|
|||
*/
|
||||
class YearTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
use ForcePropertyTrait;
|
||||
|
||||
/**
|
||||
|
@ -133,9 +131,9 @@ class YearTest extends TestCase
|
|||
{
|
||||
$subject = new Year(2020);
|
||||
|
||||
$month = $this->prophesize(Month::class);
|
||||
$month->isActive()->willReturn(false);
|
||||
$months = [$month->reveal()];
|
||||
$month = $this->createStub(Month::class);
|
||||
$month->method('isActive')->willReturn(false);
|
||||
$months = [$month];
|
||||
$this->forceProperty($subject, 'months', $months);
|
||||
|
||||
self::assertFalse($subject->isActive());
|
||||
|
@ -148,9 +146,9 @@ class YearTest extends TestCase
|
|||
{
|
||||
$subject = new Year(2020);
|
||||
|
||||
$month = $this->prophesize(Month::class);
|
||||
$month->isActive()->willReturn(true);
|
||||
$months = [$month->reveal()];
|
||||
$month = $this->createStub(Month::class);
|
||||
$month->method('isActive')->willReturn(true);
|
||||
$months = [$month];
|
||||
$this->forceProperty($subject, 'months', $months);
|
||||
|
||||
self::assertTrue($subject->isActive());
|
||||
|
|
|
@ -10,13 +10,17 @@
|
|||
}
|
||||
],
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"typo3/class-alias-loader": true,
|
||||
"typo3/cms-composer-installers": true
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.3.0 || ^7.4.0",
|
||||
"typo3/cms-core": "^10.4",
|
||||
"typo3/cms-extbase": "^10.4",
|
||||
"typo3/cms-frontend": "^10.4"
|
||||
"php": "^7.3.0 || ^7.4.0 || ^8.0.0 || ^8.1.0 || ^8.2.0",
|
||||
"typo3/cms-core": "^10.4 || ^11.5",
|
||||
"typo3/cms-extbase": "^10.4 || ^11.5",
|
||||
"typo3/cms-frontend": "^10.4 || ^11.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -30,12 +34,9 @@
|
|||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"jangregor/phpstan-prophecy": "^0.6.2",
|
||||
"maglnet/composer-require-checker": "^2.1",
|
||||
"phpspec/prophecy-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"symplify/easy-coding-standard": "^9.2",
|
||||
"typo3/cms-fluid-styled-content": "^10.4",
|
||||
"typo3/cms-fluid-styled-content": "^10.4 || ^11.5",
|
||||
"typo3/testing-framework": "^6.6"
|
||||
},
|
||||
"extra": {
|
||||
|
|
Loading…
Reference in a new issue