From c03f62ed499d7c1175923b929e82f6e361d85505 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Tue, 9 Apr 2019 12:37:57 +0200 Subject: [PATCH 1/2] configure application namespace while discovering events --- src/Illuminate/Foundation/Events/DiscoverEvents.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Events/DiscoverEvents.php b/src/Illuminate/Foundation/Events/DiscoverEvents.php index fbef40d9d4ca..c82ffc50c80d 100644 --- a/src/Illuminate/Foundation/Events/DiscoverEvents.php +++ b/src/Illuminate/Foundation/Events/DiscoverEvents.php @@ -67,6 +67,10 @@ protected static function classFromFile(SplFileInfo $file, $basePath) { $class = trim(str_replace($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR); - return str_replace(DIRECTORY_SEPARATOR, '\\', ucfirst(Str::replaceLast('.php', '', $class))); + return str_replace( + [DIRECTORY_SEPARATOR, 'App\\'], + ['\\', app()->getNamespace()], + ucfirst(Str::replaceLast('.php', '', $class)) + ); } } From b1b10ec46e5657a4c1d15a7b449bf99424b2cdf1 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Tue, 9 Apr 2019 13:05:20 +0200 Subject: [PATCH 2/2] fix tests --- .../EventDiscovery/Events/EventOne.php | 7 ------ .../EventDiscovery/Events/EventTwo.php | 7 ------ .../EventDiscovery/Listeners/Listener.php | 24 ------------------- .../Foundation/DiscoverEventsTest.php | 12 +++++----- .../EventDiscovery/Events/EventOne.php | 7 ++++++ .../EventDiscovery/Events/EventTwo.php | 7 ++++++ .../EventDiscovery/Listeners/Listener.php | 24 +++++++++++++++++++ 7 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 tests/Foundation/Fixtures/EventDiscovery/Events/EventOne.php delete mode 100644 tests/Foundation/Fixtures/EventDiscovery/Events/EventTwo.php delete mode 100644 tests/Foundation/Fixtures/EventDiscovery/Listeners/Listener.php rename tests/{ => Integration}/Foundation/DiscoverEventsTest.php (55%) create mode 100644 tests/Integration/Foundation/Fixtures/EventDiscovery/Events/EventOne.php create mode 100644 tests/Integration/Foundation/Fixtures/EventDiscovery/Events/EventTwo.php create mode 100644 tests/Integration/Foundation/Fixtures/EventDiscovery/Listeners/Listener.php diff --git a/tests/Foundation/Fixtures/EventDiscovery/Events/EventOne.php b/tests/Foundation/Fixtures/EventDiscovery/Events/EventOne.php deleted file mode 100644 index fbd2d849e6b7..000000000000 --- a/tests/Foundation/Fixtures/EventDiscovery/Events/EventOne.php +++ /dev/null @@ -1,7 +0,0 @@ -