fntneves / laravel-transactional-events

Transaction-aware Event Dispatcher for Laravel
MIT License
314 stars 28 forks source link

Neves\Testing\DatabaseTransactions causes red squiggly in PHPStorm #41

Closed AlbinoDrought closed 4 years ago

AlbinoDrought commented 4 years ago

Versions:

Sample code:

<?php

namespace Tests\Unit;

use App\User;
use Neves\Testing\DatabaseTransactions;
use Tests\TestCase;

class UserTest extends TestCase
{
    use DatabaseTransactions; // squiggly here

    public function testSquiggly()
    {
        $this->assertInstanceOf(
            User::class,
            factory(User::class)->create(),
            'this is not a real test'
        );
    }
}

Screenshot of sample code in PHPStorm:

image

Message shown on squiggly hover:

Trait method 'beginDatabaseTransaction' will not be applied, because it collides with 'DatabaseTransactions'

image

Perhaps this is more of a PHPStorm bug? The method does seem to be applied. Adding dd('foo') to the beginning of it:

    use BaseDatabaseTransactions;

    public function beginDatabaseTransaction()
    {
        dd('foo');
        $emptyDispatcher = new \Illuminate\Events\Dispatcher;

Successfully prints 'foo':

application@68261664050d:/app$ vendor/bin/phpunit --filter UserTest
PHPUnit 8.5.4 by Sebastian Bergmann and contributors.

.."foo"

And no fatal errors are emitted by PHP itself.

AlbinoDrought commented 4 years ago

Nevermind, seems to be a PHPStorm bug: https://youtrack.jetbrains.com/issue/WI-53171

Thanks!!