Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1']
php: ['8.3']
phpunit: ['phpunit.xml', 'phpunit-integration-legacy.xml']

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.lock
.phpunit.result.cache
.php-cs-fixer.cache
var
.phpunit.cache
4 changes: 2 additions & 2 deletions bundle/Core/ScheduledVisibilityService.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ private function isValid(Content $content): bool
}

if (
($publishFromField->fieldTypeIdentifier !== 'ezdatetime' && $publishFromField->fieldTypeIdentifier !== 'ezdate')
|| ($publishToField->fieldTypeIdentifier !== 'ezdatetime' && $publishToField->fieldTypeIdentifier !== 'ezdate')
($publishFromField->fieldTypeIdentifier !== 'ibexa_datetime' && $publishFromField->fieldTypeIdentifier !== 'ibexa_date')
|| ($publishToField->fieldTypeIdentifier !== 'ibexa_datetime' && $publishToField->fieldTypeIdentifier !== 'ibexa_date')
) {
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
}
],
"require": {
"php": ">=8.1",
"ibexa/core": "^4.5"
"php": ">=8.3",
"ibexa/core": "^5.0"
},
"require-dev": {
"phpunit/phpunit": "^10",
"matthiasnoback/symfony-dependency-injection-test": "^4.1"
"phpunit/phpunit": "^12",
"matthiasnoback/symfony-dependency-injection-test": "^6.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\DependencyInjection\NetgenIbexaScheduledVisibilityExtension;
use PHPUnit\Framework\Attributes\DataProvider;

final class NetgenIbexaScheduledVisibilityTest extends AbstractExtensionTestCase
{
Expand Down Expand Up @@ -277,9 +278,7 @@ public static function provideContentTypesConfigurationCases(): iterable
];
}

/**
* @dataProvider provideDefaultConfigurationCases
*/
#[DataProvider('provideDefaultConfigurationCases')]
public function testDefaultConfiguration(array $configuration): void
{
$this->load($configuration);
Expand Down Expand Up @@ -322,9 +321,7 @@ public function testDefaultConfiguration(array $configuration): void
);
}

/**
* @dataProvider provideEnabledConfigurationCases
*/
#[DataProvider('provideEnabledConfigurationCases')]
public function testEnabledConfiguration(array $configuration, bool $expectedParameterValue): void
{
$this->load($configuration);
Expand All @@ -335,9 +332,7 @@ public function testEnabledConfiguration(array $configuration, bool $expectedPar
);
}

/**
* @dataProvider provideHandlerConfigurationCases
*/
#[DataProvider('provideHandlerConfigurationCases')]
public function testHandlerConfiguration(array $configuration, string $expectedParameterValue): void
{
$this->load($configuration);
Expand All @@ -348,9 +343,7 @@ public function testHandlerConfiguration(array $configuration, string $expectedP
);
}

/**
* @dataProvider provideSectionConfigurationCases
*/
#[DataProvider('provideSectionConfigurationCases')]
public function testSectionConfiguration(array $configuration, array $expectedParameterValues): void
{
$this->load($configuration);
Expand All @@ -365,9 +358,7 @@ public function testSectionConfiguration(array $configuration, array $expectedPa
);
}

/**
* @dataProvider provideObjectStateConfigurationCases
*/
#[DataProvider('provideObjectStateConfigurationCases')]
public function testObjectStateConfiguration(array $configuration, array $expectedParameterValues): void
{
$this->load($configuration);
Expand All @@ -386,9 +377,7 @@ public function testObjectStateConfiguration(array $configuration, array $expect
);
}

/**
* @dataProvider provideContentTypesConfigurationCases
*/
#[DataProvider('provideContentTypesConfigurationCases')]
public function testContentTypesConfiguration(array $configuration, array $expectedParameterValues): void
{
$this->load($configuration);
Expand Down
24 changes: 12 additions & 12 deletions tests/bundle/Integration/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use DateTime;
use Ibexa\Contracts\Core\Repository\Values\Content\Content;
use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType;
use Ibexa\Tests\Integration\Core\Repository\BaseTest as APIBaseTest;
use Ibexa\Tests\Integration\Core\Repository\BaseTestCase as APIBaseTest;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\ScheduledVisibilityService;

abstract class BaseTest extends APIBaseTest
Expand All @@ -25,42 +25,42 @@ public static function provideCases(): iterable
[
[
'publish_from' => null,
'publish_to' => new DateTime('tomorrow'),
'publish_to' => new DateTime('tomorrow', new \DateTimeZone('UTC')),
],
false,
],
[
[
'publish_from' => null,
'publish_to' => new DateTime('yesterday'),
'publish_to' => new DateTime('yesterday', new \DateTimeZone('UTC')),
],
true,
],
[
[
'publish_from' => new DateTime('2 days ago'),
'publish_to' => new DateTime('yesterday'),
'publish_from' => new DateTime('2 days ago', new \DateTimeZone('UTC')),
'publish_to' => new DateTime('yesterday', new \DateTimeZone('UTC')),
],
true,
],
[
[
'publish_from' => new DateTime('yesterday'),
'publish_to' => new DateTime('tomorrow'),
'publish_from' => new DateTime('yesterday', new \DateTimeZone('UTC')),
'publish_to' => new DateTime('tomorrow', new \DateTimeZone('UTC')),
],
false,
],
[
[
'publish_from' => new DateTime('tomorrow'),
'publish_from' => new DateTime('tomorrow', new \DateTimeZone('UTC')),
'publish_to' => null,
],
true,
],
[
[
'publish_from' => new DateTime('tomorrow'),
'publish_to' => new DateTime('2 day'),
'publish_from' => new DateTime('tomorrow', new \DateTimeZone('UTC')),
'publish_to' => new DateTime('2 day', new \DateTimeZone('UTC')),
],
true,
],
Expand Down Expand Up @@ -93,14 +93,14 @@ protected function createContentType(): ContentType
$typeCreate->creatorId = $this->generateId('user', $permissionResolver->getCurrentUserReference()->getUserId());
$typeCreate->creationDate = $this->createDateTime();

$publishFromFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('publish_from', 'ezdate');
$publishFromFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('publish_from', 'ibexa_date');
$publishFromFieldCreate->names = [
'eng-GB' => 'Publish from',
];
$publishFromFieldCreate->position = 1;
$typeCreate->addFieldDefinition($publishFromFieldCreate);

$publishToFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('publish_to', 'ezdatetime');
$publishToFieldCreate = $contentTypeService->newFieldDefinitionCreateStruct('publish_to', 'ibexa_datetime');
$publishToFieldCreate->names = [
'eng-GB' => 'Publish to',
];
Expand Down
5 changes: 2 additions & 3 deletions tests/bundle/Integration/ContentAndLocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\VisibilityHandler\Content;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\VisibilityHandler\ContentAndLocation;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\VisibilityHandler\Location;
use PHPUnit\Framework\Attributes\DataProvider;

final class ContentAndLocationTest extends BaseTest
{
/**
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
public function testUpdateVisibility(array $configuration, bool $expectedHidden)
{
$scheduledVisibilityService = $this->getScheduledVisibilityService();
Expand Down
5 changes: 2 additions & 3 deletions tests/bundle/Integration/ContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
namespace Netgen\IbexaScheduledVisibility\Tests\Integration;

use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\VisibilityHandler\Content;
use PHPUnit\Framework\Attributes\DataProvider;

final class ContentTest extends BaseTest
{
/**
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
public function testUpdateVisibility(array $configuration, bool $expectedHidden)
{
$scheduledVisibilityService = $this->getScheduledVisibilityService();
Expand Down
5 changes: 2 additions & 3 deletions tests/bundle/Integration/LocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
namespace Netgen\IbexaScheduledVisibility\Tests\Integration;

use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\VisibilityHandler\Location;
use PHPUnit\Framework\Attributes\DataProvider;

final class LocationTest extends BaseTest
{
/**
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
public function testUpdateVisibility(array $configuration, bool $expectedHidden)
{
$scheduledVisibilityService = $this->getScheduledVisibilityService();
Expand Down
5 changes: 2 additions & 3 deletions tests/bundle/Integration/ObjectStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState as ObjectStateValue;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\VisibilityHandler\ObjectState;
use PHPUnit\Framework\Attributes\DataProvider;

final class ObjectStateTest extends BaseTest
{
/**
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
public function testUpdateVisibility(array $configuration, bool $expectedHidden)
{
$scheduledVisibilityService = $this->getScheduledVisibilityService();
Expand Down
5 changes: 2 additions & 3 deletions tests/bundle/Integration/SectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

use Ibexa\Contracts\Core\Repository\Values\Content\Section as SectionValue;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\VisibilityHandler\Section;
use PHPUnit\Framework\Attributes\DataProvider;

final class SectionTest extends BaseTest
{
/**
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
public function testUpdateVisibility(array $configuration, bool $expectedHidden)
{
$scheduledVisibilityService = $this->getScheduledVisibilityService();
Expand Down