Summer Sale! All accounts are 50% off this week.

abkrim's avatar
Level 13

Using spatie un package development

I'm creating a new Laravel package using spatie/package-skeleton-laravel.

  • In the command created as an example, I have added a ray("Message"), to check its operation.
  • Once the package is installed in a development application, the command works fine and the message is displayed in ray.

However, tests that passed perfectly without the ray now fail.

  FAILED  Tests\ArchTest > it will not use debugging functions                                                                                                                                         ArchExpectationFailedException   
  Expecting 'ray' not to be used on 'Abkrim\LaraRsync\Commands\LaraRsyncCommand'.

  at src/Commands/LaraRsyncCommand.php:17
     13▕     public function handle(): int
     14▕     {
     15▕         $this->comment('All done');
     16▕ 
  ➜  17▕         ray("Hello...");

In the PackageServiceProvider has according spatie's doc:

    protected function getPackageProviders($app): array
    {
        return [
            \Spatie\LaravelRay\RayServiceProvider::class,
        ];
    }

Any help?

0 likes
1 reply
abkrim's avatar
Level 13

After reading AI's absurd response, read the test and see the problem.

<?php

arch('it will not use debugging functions')
    ->expect(['dd', 'dump', 'ray'])
    ->each->not->toBeUsed();

Remove 'ray' and test pass.

Please or to participate in this conversation.