Skip to content

Commit

Permalink
Merge pull request #1095: New interceptors
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Apr 29, 2024
1 parent 8e88e24 commit c053d0d
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/Declaration/BootloaderDeclaration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Spiral\Boot\BootloadManager\Methods;
use Spiral\Boot\KernelInterface;
use Spiral\Bootloader\DomainBootloader;
use Spiral\Core\CoreInterface;
use Spiral\Interceptors\HandlerInterface;
use Spiral\Scaffolder\Config\ScaffolderConfig;

class BootloaderDeclaration extends AbstractDeclaration implements HasInstructions
Expand Down Expand Up @@ -45,9 +45,9 @@ public function declare(): void

if ($this->isDomain) {
$this->class->addConstant('INTERCEPTORS', [])->setProtected();
$this->namespace->addUse(CoreInterface::class);
$this->namespace->addUse(HandlerInterface::class);
$this->class->getConstant('SINGLETONS')->setValue([
new Literal('CoreInterface::class => [self::class, \'domainCore\']'),
new Literal('HandlerInterface::class => [self::class, \'domainCore\']'),
]);
}

Expand Down
5 changes: 3 additions & 2 deletions tests/Command/BootloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use ReflectionClass;
use ReflectionException;
use Spiral\Core\CoreInterface;
use Spiral\Interceptors\HandlerInterface;
use Throwable;

final class BootloaderTest extends AbstractCommandTestCase
Expand Down Expand Up @@ -97,7 +98,7 @@ public function testScaffoldForDomainBootloader(): void
$this->assertTrue($reflection->hasConstant('SINGLETONS'));

$this->assertEquals([
CoreInterface::class => ['Spiral\Tests\Scaffolder\App\Bootloader\SampleDomainBootloader', 'domainCore'],
HandlerInterface::class => ['Spiral\Tests\Scaffolder\App\Bootloader\SampleDomainBootloader', 'domainCore'],
], $reflection->getConstant('SINGLETONS'));
}

Expand All @@ -112,7 +113,7 @@ public function testShowInstructionAfterInstallation(): void

$output = $result->getOutput()->fetch();

$this->assertSame(
$this->assertStringEqualsStringIgnoringLineEndings(
<<<OUTPUT
Declaration of 'SampleBootloader' has been successfully written into 'Bootloader/SampleBootloader.php'.
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function testShowInstructionAfterInstallation(): void

$output = $result->getOutput()->fetch();

$this->assertSame(
$this->assertStringEqualsStringIgnoringLineEndings(
<<<OUTPUT
Declaration of 'ArgumentCommand' has been successfully written into 'Command/ArgumentCommand.php'.
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function testShowInstructionAfterInstallation(): void

$output = $result->getOutput()->fetch();

$this->assertSame(
$this->assertStringEqualsStringIgnoringLineEndings(
<<<OUTPUT
Declaration of 'InstructionConfig' has been successfully written into 'Config/InstructionConfig.php'.
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function testShowInstructionAfterInstallation(): void

$output = $result->getOutput()->fetch();

$this->assertSame(
$this->assertStringEqualsStringIgnoringLineEndings(
<<<OUTPUT
Declaration of 'SampleController' has been successfully written into 'Custom/Controller/SampleController.php'.
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/FilterCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function testShowInstructionAfterInstallation(): void

$output = $result->getOutput()->fetch();

$this->assertSame(
$this->assertStringEqualsStringIgnoringLineEndings(
<<<OUTPUT
Declaration of 'SampleFilter' has been successfully written into 'Filter/SampleFilter.php'.
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/JobHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testShowInstructionAfterInstallation(): void

$output = $result->getOutput()->fetch();

$this->assertSame(
$this->assertStringEqualsStringIgnoringLineEndings(
<<<OUTPUT
Declaration of 'SampleJob' has been successfully written into 'Job/SampleJob.php'.
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/MiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testShowInstructionAfterInstallation(): void

$output = $result->getOutput()->fetch();

$this->assertSame(
$this->assertStringEqualsStringIgnoringLineEndings(
<<<OUTPUT
Declaration of 'SampleMiddleware' has been successfully written into 'Middleware/SampleMiddleware.php'.
Expand Down

0 comments on commit c053d0d

Please sign in to comment.