Skip to content

Commit 5528074

Browse files
authored
[12.x] Add maintenance mode facade for easier driver extension (#56090)
* maintenance mode facade * alias in provider * fix bindings * fix cs * noop driver * different cs to pint * revert container binding changes
1 parent d7df269 commit 5528074

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Illuminate\Support\Facades;
4+
5+
use Illuminate\Foundation\MaintenanceModeManager;
6+
7+
class MaintenanceMode extends Facade
8+
{
9+
/**
10+
* Get the registered name of the component.
11+
*
12+
* @return string
13+
*/
14+
protected static function getFacadeAccessor()
15+
{
16+
return MaintenanceModeManager::class;
17+
}
18+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace Illuminate\Tests\Support;
4+
5+
use Illuminate\Contracts\Foundation\MaintenanceMode as MaintenanceModeContract;
6+
use Illuminate\Support\Facades\MaintenanceMode;
7+
use Orchestra\Testbench\TestCase;
8+
9+
class SupportMaintenanceModeTest extends TestCase
10+
{
11+
public function testExtends()
12+
{
13+
MaintenanceMode::extend('test', fn () => new TestMaintenanceMode);
14+
15+
$this->app->config->set('app.maintenance.driver', 'test');
16+
17+
$this->assertInstanceOf(TestMaintenanceMode::class, $this->app->maintenanceMode());
18+
}
19+
}
20+
21+
class TestMaintenanceMode implements MaintenanceModeContract
22+
{
23+
public function activate(array $payload): void
24+
{
25+
}
26+
27+
public function deactivate(): void
28+
{
29+
}
30+
31+
public function active(): bool
32+
{
33+
}
34+
35+
public function data(): array
36+
{
37+
}
38+
}

0 commit comments

Comments
 (0)