orchestral / testbench

Laravel Testing Helper for Packages Development
https://packages.tools/testbench
MIT License
2.1k stars 136 forks source link

laravel/storage" could not be opened in append mode: failed to open stream: Is a directory #321

Closed Stevemoretz closed 2 years ago

Stevemoretz commented 2 years ago

Description:

when I add this:

    protected function defineDatabaseMigrations() {
        $this->loadMigrationsFrom(__DIR__ . '/database/migrations');
    }

I get the following error:

In StreamHandler.php line 146:

  The stream or file "/Volumes/HDD/Websites/wordpress-clean/wp-content/mu-plu  
  gins/fast/Lumen/packages/stevemoretz/push/vendor/orchestra/testbench-core/l  
  aravel/storage" could not be opened in append mode: failed to open stream:   
  Is a directory 

Here's the trace:

12:43:44
Trace
23
Illuminate\Testing\PendingCommand:run
22
Orchestra\Testbench\{closure}
21
tap
20
Orchestra\Testbench\artisan
19
Orchestra\Testbench\Database\MigrateProcessor:dispatch
18
Orchestra\Testbench\Database\MigrateProcessor:up
17
Orchestra\Testbench\TestCase:loadMigrationsFrom
16
SteveMoretz\PushNotification\Tests\TestCase:defineDatabaseMigrations
15
Orchestra\Testbench\TestCase:setUpDatabaseRequirements
14
Orchestra\Testbench\TestCase:setUpTheTestEnvironmentTraits
13
Orchestra\Testbench\TestCase:setUpTraits
12
Orchestra\Testbench\TestCase:setUpTheTestEnvironment
11
Orchestra\Testbench\TestCase:setUp
10
SteveMoretz\PushNotification\Tests\TestCase:setUp
9
PHPUnit\Framework\TestCase:runBare
8
PHPUnit\Framework\TestResult:run
7
PHPUnit\Framework\TestCase:run
6
PHPUnit\Framework\TestSuite:run
5
PHPUnit\Framework\TestSuite:run
4
PHPUnit\TextUI\TestRunner:run
3
PHPUnit\TextUI\Command:run
2
PHPUnit\TextUI\Command:main
1
[top]
PendingCommand.php:260

I traced it, down to PendingCommand.php:260

            $exitCode = $this->app->make(Kernel::class)->call($this->command, $this->parameters, $mock);

This is the line that causes the error to occur I can dd before it and no error, I cannot dd after it even this:

        try {
            $exitCode = $this->app->make(Kernel::class)->call($this->command, $this->parameters, $mock);
        } catch (NoMatchingExpectationException $e) {
            dd($e);
            if ($e->getMethodName() === 'askQuestion') {
                $this->test->fail('Unexpected question "'.$e->getActualArguments()[0]->getQuestion().'" was asked.');
            }

            throw $e;
        }catch (\Exception $e){
            dd($e);
        }

doesn't catch the error via dd, that line (PendingCommand.php:260) that does whatever it shouldn't do, and produces that error, couldn't enable xdebug for the tests, it just doesn't work.

tried putting it in a route, because xdebug works there for me :

Route::get("test", function () {
    (new \SteveMoretz\PushNotification\Tests\Unit\Topics\SubscribeToTopics())->run();
});

but on the url I get this : Class 'Orchestra\Testbench\TestCase' not found

Really stuck please help.

crynobone commented 2 years ago

Testbench does not support Lumen. Please debug and suggest a fix if you can.

Stevemoretz commented 2 years ago

I would love to debug and suggest a fix, but I needed some help first, please read the end of my message, I could not use xdebug on tests, so decided to load it in a route in web.php but there I get this error:

Class 'Orchestra\Testbench\TestCase' not found

Any help would or suggestion be useful.

crynobone commented 2 years ago

I can only suggest not to use Testbench on Lumen.

Stevemoretz commented 2 years ago

The error went away, by removing the namespace from the migration class, no idea what is the connection though. It probably didn't have anything to do with lumen.