Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor console kernel bootstrapper loading #1771

Merged
merged 10 commits into from
Jul 1, 2024
Next Next commit
Cleanup test doumentation
  • Loading branch information
caendesilva committed Jul 1, 2024
commit cf7b317f4f5e5c6501e8a151437461f8bf9991dd
10 changes: 6 additions & 4 deletions packages/framework/tests/Feature/ConsoleKernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
use ReflectionMethod;

/**
* This test covers our custom console kernel, which is responsible for registering our custom bootstrappers.
*
* @covers \Hyde\Foundation\ConsoleKernel
*
* Our custom bootstrapping system depends on code from Laravel Zero which is marked as internal.
* Sadly, there is no way around working with this private API. Since they may change the API
* at any time, we have tests here to detect if their code changes, so we can catch it early.
*/
class ConsoleKernelTest extends TestCase
{
Expand All @@ -29,15 +35,11 @@ public function testBootstrappers()
{
$kernel = app(ConsoleKernel::class);

// Normally, protected code does not need to be unit tested, but since this array is so vital, we want to inspect it.
$bootstrappers = (new ReflectionMethod($kernel, 'bootstrappers'))->invoke($kernel);

$this->assertIsArray($bootstrappers);
$this->assertContains(LoadYamlConfiguration::class, $bootstrappers);

// Another assertion that is usually a no-no, testing vendor code, especially those which are marked as internal.
// We do this here however, so we get a heads-up if the vendor code changes as that could break our code.

$this->assertSame([
0 => 'LaravelZero\Framework\Bootstrap\CoreBindings',
1 => 'LaravelZero\Framework\Bootstrap\LoadEnvironmentVariables',
Expand Down