-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat, refactor: application with bootstrapper
- add karnel register appliaction bootstrapper - add BootProvider: to call `Application::bootProvider` - add RegisterProvider: to call `Application::registerProvider`
- Loading branch information
1 parent
64404de
commit 8546412
Showing
10 changed files
with
190 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace System\Integrate\Bootstrap; | ||
|
||
use System\Integrate\Application; | ||
|
||
class BootProviders | ||
{ | ||
public function bootstrap(Application $app): void | ||
{ | ||
$app->bootProvider(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace System\Integrate\Bootstrap; | ||
|
||
use System\Integrate\Application; | ||
|
||
class RegisterProviders | ||
{ | ||
public function bootstrap(Application $app): void | ||
{ | ||
$app->registerProvider(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace System\Integrate\Bootstrap; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use System\Integrate\Application; | ||
|
||
class BootProvidersTest extends TestCase | ||
{ | ||
public function testBootstrap(): void | ||
{ | ||
$app = new Application(__DIR__); | ||
|
||
$this->assertFalse($app->isBooted()); | ||
$app->bootstrapWith([BootProviders::class]); | ||
$this->assertTrue($app->isBooted()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace System\Integrate\Bootstrap; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use System\Integrate\Application; | ||
use System\Integrate\ServiceProvider; | ||
|
||
class RegisterProvidersTest extends TestCase | ||
{ | ||
public function testBootstrap(): void | ||
{ | ||
$app = new Application(__DIR__); | ||
$app->register(TestRegisterServiceProvider::class); | ||
$app->bootstrapWith([BootProviders::class]); | ||
$this->assertCount(2, (fn () => $this->{'looded_providers'})->call($app), '1 from defult provider, 1 from this test.'); | ||
} | ||
} | ||
|
||
class TestRegisterServiceProvider extends ServiceProvider | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters