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
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'

jobs:
test:
name: "Test (PHP ${{ matrix.php-versions }}, Neos ${{ matrix.neos-versions }})"

strategy:
fail-fast: false
matrix:
php-versions: [ '8.2', '8.4' ]
neos-versions: [ '8.3', '8.4' ]

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{ env.FLOW_FOLDER }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite
ini-values: date.timezone="Africa/Tunis", opcache.fast_shutdown=0, apc.enable_cli=on

- name: Set Neos Version
run: composer require neos/neos ^${{ matrix.neos-versions }} --no-progress --no-interaction

- name: Lint
run: composer lint

- name: Stan
run: composer analyse
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
**/node_modules/**
node_modules
**/lib/
.yarn
.yarn

composer.lock
Packages
vendor
bin
Build
3 changes: 2 additions & 1 deletion Classes/Domain/StartDateIsMissing.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ final class StartDateIsMissing extends \InvalidArgumentException
{
public static function butWasRequired(string $attemptedValue): self
{
return new self('Start date is missing in value ' . $attemptedValue
return new self(
'Start date is missing in value ' . $attemptedValue
. ', must contain a DTSTART: line',
1746602782
);
Expand Down
3 changes: 2 additions & 1 deletion Classes/Infrastructure/CalendarIsMissing.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ final class CalendarIsMissing extends \RuntimeException
{
public static function butWasRequired(NodeAggregateIdentifier $eventId): self
{
return new self('Failed to resolve calendar ID for event '
return new self(
'Failed to resolve calendar ID for event '
. $eventId . ', one of its ancestors must be a calendar',
1745919357
);
Expand Down
3 changes: 2 additions & 1 deletion Classes/Infrastructure/LocationIsMissing.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ final class LocationIsMissing extends \RuntimeException
{
public static function butWasRequired(NodeAggregateIdentifier $eventId): self
{
return new self('Failed to resolve location time zone for event '
return new self(
'Failed to resolve location time zone for event '
. $eventId . ', one of its ancestors must be a location',
1746795172
);
Expand Down
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Sitegeist.GroundhogDay

> NodeTypes and PHP Tools for Events including recurrence rules
> based on RFC 5545 - iCalendar

The package will calculate all future occurences for the next Year based on the contained nodeType mixins.
The PHP class `Sitegeist\GroundhogDay\Domain\EventOccurrenceRepository` can be used to fetch events
based on calendar, location and time-period.

## Authors & Sponsors

* Bernhard Schmitt - schmitt@sitegeist.de

_The development and the public-releases of this package is generously sponsored by our employer http://www.sitegeist.de._

## Installation

Sitegeist.GroundhogDay is available via packagist:
```shell
composer require sitegeist/groundhogday
```

## Usage

### NodeTypes

- Sitegeist.GroundhogDay:Mixin.Calendar
- Sitegeist.GroundhogDay:Mixin.Event
- Sitegeist.GroundhogDay:Mixin.Location

# to be written

## Contributions

We will gladly accept contributions. Please send us pull requests.

In lieu of a formal styleguide, take care to maintain the existing coding style. Please make sure to contribute [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) compliant sources.

## License

See [LICENSE.md](./LICENSE.md)
11 changes: 9 additions & 2 deletions Tests/Unit/Domain/EventOccurrenceSpecificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testFromArray(array $array, EventOccurrenceSpecification $expect
}

/**
* @return iterable<int,array{array: array<string,mixed>, expectedSpecification: EventOccurrenceSpecification}>
* @return iterable<string, array{array: array<string,mixed>, expectedSpecification: EventOccurrenceSpecification}>
*/
public static function arrayProvider(): iterable
{
Expand Down Expand Up @@ -115,6 +115,9 @@ public function testResolveDates(
);
}

/**
* @return iterable<string, array{subject: EventOccurrenceSpecification, afterDate: ?\DateTimeImmutable, expectedEventDates: EventDates[] }>
*/
public static function resolvedDatesProvider(): iterable
{
yield 'only startDate, no afterDate' => [
Expand Down Expand Up @@ -349,6 +352,10 @@ public static function resolvedDatesProvider(): iterable

private static function createDateTime(string $date): \DateTimeImmutable
{
return \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $date, new \DateTimeZone('UTC'));
$date = \DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $date, new \DateTimeZone('UTC'));
if ($date instanceof \DateTimeImmutable) {
return $date;
}
throw new \Exception('invalid date string: "' . $date . '"');
}
}
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan": "^1.12",
"neos/buildessentials": "^8.3",
"mikey179/vfsstream": "^1.6",
"squizlabs/php_codesniffer": "^3.6"
},
"scripts": {
"fix": "bin/phpcbf --standard=PSR12 --extensions=php --exclude=Generic.Files.LineLength Classes/ Tests/",
"lint": "bin/phpcs --standard=PSR12 --extensions=php --exclude=Generic.Files.LineLength Classes/ Tests/",
"analyse": "bin/phpstan analyse --level 9 Tests/Unit Classes",
"analyse": "bin/phpstan analyse --level 8 Tests/Unit Classes",
"test:unit": "bin/phpunit -c phpunit.xml --enforce-time-limit --coverage-html Build/Reports/coverage Tests",
"test:functional": [
"FLOW_CONTEXT=Testing bin/phpunit --colors --stop-on-failure -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml Tests/Functional"
Expand Down