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