diff --git a/README.md b/README.md index ef7d5fc..3b0d5f4 100644 --- a/README.md +++ b/README.md @@ -102,11 +102,6 @@ Laravel-specific Testing Helpers and Assertions. - [dontSeeScheduleCount](#dontseeschedulecount) - [seeInSchedule](#seeinschedule) - [dontSeeInSchedule](#dontseeinschedule) -- [ServiceProviderAsserts](#serviceproviderasserts) - - [seeRegisteredAlias](#seeregisteredalias) - - [dontSeeRegisteredAlias](#dontseeregisteredalias) - - [seeRegisteredCommand](#seeregisteredcommand) - - [dontSeeRegisteredCommand](#dontseeregisteredcommand) ## Helpers @@ -344,40 +339,6 @@ Assert that the given command is not scheduled: $this->dontSeeInSchedule('foobarbaz'); ``` -### ServiceProviderAsserts - -#### `seeRegisteredAlias()` - -Assert that the given alias is registered: - -```php -$this->seeRegisteredAlias('Twitter'); -``` - -#### `dontSeeRegisteredAlias()` - -Assert that the given alias is not registered: - -```php -$this->dontSeeRegisteredAlias('FooBarBaz'); -``` - -#### `seeRegisteredCommand()` - -Assert that the given command is registered: - -```php -$this->seeRegisteredCommand('my-command'); -``` - -#### `dontSeeRegisteredCommand()` - -Assert that the given command is not registered: - -```php -$this->dontSeeRegisteredCommand('foobarbaz'); -``` - ## Sponsors [![Laravel Idea](art/sponsor-laravel-idea.png)](https://laravel-idea.com)
diff --git a/src/Asserts/ServiceProviderAsserts.php b/src/Asserts/ServiceProviderAsserts.php deleted file mode 100644 index 6ba4af8..0000000 --- a/src/Asserts/ServiceProviderAsserts.php +++ /dev/null @@ -1,45 +0,0 @@ -assertNotEmpty(AliasLoader::getInstance()->load($alias), $message); - } - - /** - * Assert that the given alias is not registered. - */ - protected function dontSeeRegisteredAlias(string $alias): void - { - $message = "Failed asserting that alias `{$alias}` is not registered."; - $this->assertEmpty(AliasLoader::getInstance()->load($alias), $message); - } - - /** - * Assert that the given command is registered. - */ - protected function seeRegisteredCommand(string $name): void - { - $message = "Failed asserting that command `{$name}` is registered."; - $this->assertArrayHasKey($name, Artisan::all(), $message); - } - - /** - * Assert that the given command is not registered. - */ - protected function dontSeeRegisteredCommand(string $name): void - { - $message = "Failed asserting that command `{$name}` is not registered."; - $this->assertArrayNotHasKey($name, Artisan::all(), $message); - } -} diff --git a/src/TestingTools.php b/src/TestingTools.php index 3060f45..ba43518 100644 --- a/src/TestingTools.php +++ b/src/TestingTools.php @@ -7,7 +7,6 @@ use Illuminated\Testing\Asserts\FilesystemAsserts; use Illuminated\Testing\Asserts\LogFileAsserts; use Illuminated\Testing\Asserts\ScheduleAsserts; -use Illuminated\Testing\Asserts\ServiceProviderAsserts; use Illuminated\Testing\Helpers\ApplicationHelpers; trait TestingTools @@ -21,5 +20,4 @@ trait TestingTools use FilesystemAsserts; use LogFileAsserts; use ScheduleAsserts; - use ServiceProviderAsserts; } diff --git a/tests/Asserts/ServiceProviderAssertsTest.php b/tests/Asserts/ServiceProviderAssertsTest.php deleted file mode 100644 index 5c56bf1..0000000 --- a/tests/Asserts/ServiceProviderAssertsTest.php +++ /dev/null @@ -1,32 +0,0 @@ -seeRegisteredAlias('Acme\Alias\Post'); - } - - /** @test */ - public function it_has_dont_see_registered_alias_assertion() - { - $this->dontSeeRegisteredAlias('Acme\Alias\Fake'); - } - - /** @test */ - public function it_has_see_registered_command_assertion() - { - $this->seeRegisteredCommand('registered'); - } - - /** @test */ - public function it_has_dont_see_registered_command_assertion() - { - $this->dontSeeRegisteredCommand('fake'); - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php index affa95a..8a2bf5e 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,8 +5,6 @@ use Illuminate\Contracts\Console\Kernel as KernelContract; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminated\Testing\TestingTools; -use Illuminated\Testing\Tests\App\Console\Kernel; -use Illuminated\Testing\Tests\App\Providers\FixtureServiceProvider; abstract class TestCase extends \Orchestra\Testbench\TestCase { @@ -24,17 +22,6 @@ protected function setUp(): void $this->setUpStorage(); } - /** - * Get package providers. - * - * @param \Illuminate\Foundation\Application $app - * @return array - */ - protected function getPackageProviders($app) - { - return [FixtureServiceProvider::class]; - } - /** * Setup the database. */ @@ -74,7 +61,7 @@ private function setUpStorage(): void */ protected function resolveApplicationConsoleKernel($app) { - $app->singleton(KernelContract::class, Kernel::class); + parent::resolveApplicationConsoleKernel($app); app(KernelContract::class); } diff --git a/tests/TestingToolsTest.php b/tests/TestingToolsTest.php index a8ffba3..1c9df23 100644 --- a/tests/TestingToolsTest.php +++ b/tests/TestingToolsTest.php @@ -7,7 +7,6 @@ use Illuminated\Testing\Asserts\FilesystemAsserts; use Illuminated\Testing\Asserts\LogFileAsserts; use Illuminated\Testing\Asserts\ScheduleAsserts; -use Illuminated\Testing\Asserts\ServiceProviderAsserts; use Illuminated\Testing\Helpers\ApplicationHelpers; use Illuminated\Testing\TestingTools; @@ -27,6 +26,5 @@ public function it_is_using_all_testing_tools_asserts() $this->assertTraitUsed(TestingTools::class, FilesystemAsserts::class); $this->assertTraitUsed(TestingTools::class, LogFileAsserts::class); $this->assertTraitUsed(TestingTools::class, ScheduleAsserts::class); - $this->assertTraitUsed(TestingTools::class, ServiceProviderAsserts::class); } } diff --git a/tests/fixture/app/Console/Commands/RegisteredCommand.php b/tests/fixture/app/Console/Commands/RegisteredCommand.php deleted file mode 100644 index 3ae90cc..0000000 --- a/tests/fixture/app/Console/Commands/RegisteredCommand.php +++ /dev/null @@ -1,23 +0,0 @@ -info('Done!'); - } -} diff --git a/tests/fixture/app/Console/Kernel.php b/tests/fixture/app/Console/Kernel.php deleted file mode 100644 index 04211c1..0000000 --- a/tests/fixture/app/Console/Kernel.php +++ /dev/null @@ -1,7 +0,0 @@ -registerAliases(); - $this->registerCommands(); - } - - /** - * Register aliases. - */ - private function registerAliases(): void - { - $this->app->booting(function () { - $loader = AliasLoader::getInstance(); - $loader->alias('Acme\Alias\Post', Post::class); - }); - } - - /** - * Register commands. - */ - private function registerCommands(): void - { - $this->app->singleton('command.fixture.registered', RegisteredCommand::class); - - $this->commands(['command.fixture.registered']); - } -}