From 16fb80be1fed02beeecabec9c1b9df5d8fd345f3 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 28 Jan 2025 07:14:01 +0000 Subject: [PATCH] Add missing files --- src/Event/ConfigLoadedEvent.php | 42 ++++++++++++++++ tests/Unit/Event/ConfigLoadedEventTest.php | 56 ++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 src/Event/ConfigLoadedEvent.php create mode 100644 tests/Unit/Event/ConfigLoadedEventTest.php diff --git a/src/Event/ConfigLoadedEvent.php b/src/Event/ConfigLoadedEvent.php new file mode 100644 index 0000000000..8923c53681 --- /dev/null +++ b/src/Event/ConfigLoadedEvent.php @@ -0,0 +1,42 @@ +name = $name; + $this->config = $config; + } + + public function getName(): string + { + return $this->name; + } + + public function getConfig(): ConfigFileManager + { + return $this->config; + } +} diff --git a/tests/Unit/Event/ConfigLoadedEventTest.php b/tests/Unit/Event/ConfigLoadedEventTest.php new file mode 100644 index 0000000000..473b75ac89 --- /dev/null +++ b/tests/Unit/Event/ConfigLoadedEventTest.php @@ -0,0 +1,56 @@ +createStub(ConfigFileManager::class)); + + $this->assertInstanceOf(NamedEvent::class, $event); + } + + public static function getPublicConstants(): array + { + return [ + [ConfigLoadedEvent::CONFIG_LOADED, 'friendica.config_loaded'], + ]; + } + + /** + * @dataProvider getPublicConstants + */ + public function testPublicConstantsAreAvailable($value, $expected): void + { + $this->assertSame($expected, $value); + } + + public function testGetNameReturnsName(): void + { + $event = new ConfigLoadedEvent('test', $this->createStub(ConfigFileManager::class)); + + $this->assertSame('test', $event->getName()); + } + + public function testGetConfigReturnsCorrectString(): void + { + $config = $this->createStub(ConfigFileManager::class); + + $event = new ConfigLoadedEvent('test', $config); + + $this->assertSame($config, $event->getConfig()); + } +}