From e489a984ebe346e9cf3c88f295443ee5373ee001 Mon Sep 17 00:00:00 2001 From: Thorsten Bus Date: Sun, 3 May 2026 22:07:56 +0200 Subject: [PATCH] chore(deps): bump PHP to 8.4 and update propresenter/parser with Macro/Label support - Raise PHP requirement from ^8.2 to ^8.4 (parser requires 8.4) - New parser classes available: MacrosFileReader, LabelsFileReader, Macro, MacroLibrary, MacroCollection, Label, LabelLibrary - Add programmatic test fixtures for macros-sample.bin + labels-sample.bin - Fix ServiceAgendaItemFactory sort_order to auto-increment --- composer.json | 2 +- composer.lock | 12 ++-- .../factories/ServiceAgendaItemFactory.php | 4 +- tests/fixtures/generate-labels-sample.php | 40 +++++++++++ tests/fixtures/generate-macros-sample.php | 66 ++++++++++++++++++ tests/fixtures/labels-sample.bin | Bin 0 -> 133 bytes tests/fixtures/macros-sample.bin | Bin 0 -> 405 bytes 7 files changed, 116 insertions(+), 8 deletions(-) create mode 100644 tests/fixtures/generate-labels-sample.php create mode 100644 tests/fixtures/generate-macros-sample.php create mode 100644 tests/fixtures/labels-sample.bin create mode 100644 tests/fixtures/macros-sample.bin diff --git a/composer.json b/composer.json index b159660..bdd89c7 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "^8.2", + "php": "^8.4", "5pm-hdh/churchtools-api": "^2.1", "barryvdh/laravel-dompdf": "^3.1", "inertiajs/inertia-laravel": "^2.0", diff --git a/composer.lock b/composer.lock index 9fe9f23..8fd500b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "424677667864ca1fffd6f4af9632aa92", + "content-hash": "87837501106e784aa10ddd7743056cba", "packages": [ { "name": "5pm-hdh/churchtools-api", @@ -3819,7 +3819,7 @@ "source": { "type": "git", "url": "https://git.stadtmission-butzbach.de/public/propresenter-php.git", - "reference": "22ba4aff7d29683297c0397e1bbc3699dc35ac03" + "reference": "9e3e719806d8db3941444b8424fdd56b3b534aa8" }, "require": { "google/protobuf": "^4.0", @@ -3838,7 +3838,7 @@ } }, "description": "ProPresenter song file parser", - "time": "2026-03-30T11:26:29+00:00" + "time": "2026-05-03T19:40:09+00:00" }, { "name": "psr/clock", @@ -10867,8 +10867,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.2" + "php": "^8.4" }, - "platform-dev": [], - "plugin-api-version": "2.2.0" + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/database/factories/ServiceAgendaItemFactory.php b/database/factories/ServiceAgendaItemFactory.php index 0d2bd72..66981ac 100644 --- a/database/factories/ServiceAgendaItemFactory.php +++ b/database/factories/ServiceAgendaItemFactory.php @@ -9,6 +9,8 @@ class ServiceAgendaItemFactory extends Factory { + private static int $nextSortOrder = 1; + protected $model = ServiceAgendaItem::class; public function definition(): array @@ -28,7 +30,7 @@ public function definition(): array $this->faker->numberBetween(1, 2) ), 'service_song_id' => null, - 'sort_order' => $this->faker->numberBetween(1, 20), + 'sort_order' => self::$nextSortOrder++, ]; } diff --git a/tests/fixtures/generate-labels-sample.php b/tests/fixtures/generate-labels-sample.php new file mode 100644 index 0000000..544981a --- /dev/null +++ b/tests/fixtures/generate-labels-sample.php @@ -0,0 +1,40 @@ +setRed($r); + $color->setGreen($g); + $color->setBlue($b); + $color->setAlpha($a); + + return $color; +} + +$doc = new ProLabelsDocument(); + +$labels = [ + ['name' => 'Copyright', 'r' => 0.8, 'g' => 0.2, 'b' => 0.2], + ['name' => 'Vers 1', 'r' => 0.2, 'g' => 0.6, 'b' => 0.9], + ['name' => 'Refrain', 'r' => 0.9, 'g' => 0.7, 'b' => 0.1], + ['name' => 'Brücke', 'r' => 0.5, 'g' => 0.1, 'b' => 0.8], +]; + +$labelObjects = []; +foreach ($labels as $data) { + $label = new Label(); + $label->setText($data['name']); + $label->setColor(makeColor($data['r'], $data['g'], $data['b'])); + $labelObjects[] = $label; +} +$doc->setLabels($labelObjects); + +$output = $doc->serializeToString(); +file_put_contents(__DIR__.'/labels-sample.bin', $output); +echo 'Written '.strlen($output).' bytes'.PHP_EOL; diff --git a/tests/fixtures/generate-macros-sample.php b/tests/fixtures/generate-macros-sample.php new file mode 100644 index 0000000..432404b --- /dev/null +++ b/tests/fixtures/generate-macros-sample.php @@ -0,0 +1,66 @@ +setString(strtoupper($value)); + + return $uuid; +} + +function makeColor(float $r, float $g, float $b, float $a = 1.0): Color +{ + $color = new Color(); + $color->setRed($r); + $color->setGreen($g); + $color->setBlue($b); + $color->setAlpha($a); + + return $color; +} + +$doc = new MacrosDocument(); + +$macros = [ + ['uuid' => 'AAAAAAAA-1111-2222-3333-FFFFFFFFFFFF', 'name' => 'Copyright Makro', 'r' => 1.0, 'g' => 0.5, 'b' => 0.0], + ['uuid' => 'BBBBBBBB-1111-2222-3333-FFFFFFFFFFFF', 'name' => 'Vers Makro', 'r' => 0.0, 'g' => 0.8, 'b' => 0.2], + ['uuid' => 'CCCCCCCC-1111-2222-3333-FFFFFFFFFFFF', 'name' => 'Refrain Makro', 'r' => 0.2, 'g' => 0.4, 'b' => 1.0], +]; + +$macroObjects = []; +foreach ($macros as $data) { + $macro = new Macro(); + $macro->setUuid(makeUuid($data['uuid'])); + $macro->setName($data['name']); + $macro->setColor(makeColor($data['r'], $data['g'], $data['b'])); + $macro->setTriggerOnStartup(false); + $macro->setImageType(0); + $macroObjects[] = $macro; +} +$doc->setMacros($macroObjects); + +$collection = new MacroCollection(); +$collection->setUuid(makeUuid('8D02FC57-83F8-4042-9B90-81C229728426')); +$collection->setName('--MAIN--'); + +$items = []; +foreach ($macros as $data) { + $item = new Item(); + $item->setMacroId(makeUuid($data['uuid'])); + $items[] = $item; +} +$collection->setItems($items); +$doc->setMacroCollections([$collection]); + +$output = $doc->serializeToString(); +file_put_contents(__DIR__.'/macros-sample.bin', $output); +echo 'Written '.strlen($output).' bytes'.PHP_EOL; diff --git a/tests/fixtures/labels-sample.bin b/tests/fixtures/labels-sample.bin new file mode 100644 index 0000000000000000000000000000000000000000..111766f75ccc1de84ee078979da4e15d8b74f0aa GIT binary patch literal 133 zcmd;56ykKwFQ_caOwTBh65&02#>ZY1NZ84O2vr7#274|!A-1s8qGAO@h`gQXteKMb zvT12)_7Hh_A@-ouw4%h!JfH%Qu&A-Iu|3d$Gq!LAPDO|JBxk1r6)-R`fNVHp3$g)X F0swBSC!YWS literal 0 HcmV?d00001 diff --git a/tests/fixtures/macros-sample.bin b/tests/fixtures/macros-sample.bin new file mode 100644 index 0000000000000000000000000000000000000000..c97f709d10a15fa41ee58cee5a30b872ad8ed1c2 GIT binary patch literal 405 zcmWgg;!@*MafAY0Lm<#K0s>uQAkcL~0z&-G`303lnduoN3ciWiMfpFUU&ci literal 0 HcmV?d00001