File tree Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ ## 0.5.3 - 2021-08-14
6+
57### Changed
68
79- Post-processors don't run if Laravel is compiling views.
1012
1113- You can set ` tab_width ` to ` false ` to output literal tabs into the rendered HTML.
1214
15+ ### Fixed
16+
17+ - Livewire middleware won't be registered for V1 of Livewire, since it's not possible.
18+
1319## 0.5.2 - 2021-08-02
1420
1521### Fixed
Original file line number Diff line number Diff line change @@ -66,7 +66,13 @@ public function registerBladeComponent()
6666
6767 public function registerLivewire ()
6868 {
69- if (class_exists ('\\Livewire \\Livewire ' )) {
69+ // Check for the Livewire Facade.
70+ if (!class_exists ('\\Livewire \\Livewire ' )) {
71+ return ;
72+ }
73+
74+ // Livewire 1.x does not have the `addPersistentMiddleware` method.
75+ if (method_exists (\Livewire \LivewireManager::class, 'addPersistentMiddleware ' )) {
7076 \Livewire \Livewire::addPersistentMiddleware ([
7177 RenderTorchlight::class,
7278 ]);
Original file line number Diff line number Diff line change 1212use Illuminate \Http \Client \Request ;
1313use Illuminate \Support \Arr ;
1414use Illuminate \Support \Facades \Http ;
15+ use Livewire \LivewireServiceProvider ;
1516use Orchestra \Testbench \TestCase ;
1617use Torchlight \TorchlightServiceProvider ;
1718
@@ -28,9 +29,15 @@ protected function setUp(): void
2829
2930 protected function getPackageProviders ($ app )
3031 {
31- return [
32- TorchlightServiceProvider::class
32+ $ providers = [
33+ TorchlightServiceProvider::class,
3334 ];
35+
36+ if (class_exists ('\\Livewire \\LivewireServiceProvider ' )) {
37+ $ providers [] = LivewireServiceProvider::class;
38+ }
39+
40+ return $ providers ;
3441 }
3542
3643 protected function fakeApi ()
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * @author Aaron Francis <aaron@hammerstone.dev|https://twitter.com/aarondfrancis>
4+ */
5+
6+ namespace Torchlight \Tests ;
7+
8+ use Composer \InstalledVersions ;
9+ use Livewire \Livewire ;
10+ use Torchlight \Middleware \RenderTorchlight ;
11+
12+ class LivewireTest extends BaseTest
13+ {
14+ /** @test */
15+ public function livewire_2_registers_a_middleware ()
16+ {
17+ // Check for the Livewire Facade.
18+ if (!class_exists ('\\Livewire \\Livewire ' )) {
19+ return $ this ->markTestSkipped ('Livewire not installed. ' );
20+ }
21+
22+ $ version = InstalledVersions::getVersion ('livewire/livewire ' );
23+
24+ if (version_compare ($ version , '2.0.0 ' , '>= ' )) {
25+ $ this ->assertTrue (in_array (
26+ RenderTorchlight::class,
27+ Livewire::getPersistentMiddleware ()
28+ ));
29+ } else {
30+ $ this ->markTestSkipped ('Livewire 1 cannot register middleware. ' );
31+ }
32+ }
33+
34+ }
You can’t perform that action at this time.
0 commit comments