2 years ago

PHPUnit checking errors incorrect in PHPStorm?

Posted 2 years ago by spqa

I'm trying to follow the topic Build the forum with TDD approach. You know that PHPUnit is very important to display errors when we running a TestCase.

The problem is when I'm running test by command line is work but when I'm trying to run the test with PHPStorm, it works incorrectly.

This code:

    /** @test */
    public function an_authenticated_user_only_favorite_reply_once_time()

        $reply = create(Reply::class);

        // Like a reply multiple time (store favorites)
        $this->post('replies/' . $reply->id . '/favorites');
        $this->post('replies/' . $reply->id . '/favorites');

        $this->assertCount(1, $reply->favorites);

and PHPStorm message show:

C:\laragon\bin\php\php-7.1.12-Win32-VC14-x64\php.exe E:/Coding/PG/ATeam/forum/vendor/phpunit/phpunit/phpunit --no-configuration --filter "/::an_authenticated_user_only_favorite_reply_once_time( .*)?$/" Tests\Feature\FavoritesTest E:\Coding\PG\ATeam\forum\tests\Feature\FavoritesTest.php --teamcity
PHPUnit 7.0.2 by Sebastian Bergmann and contributors.

Failed asserting that actual size 0 matches expected size 1.

Anyone can tell me why?

Please sign in or create an account to participate in this conversation.