specialtactics / laravel-api-boilerplate

Laravel API Boilerplate | Quickly build quality API products!
MIT License
497 stars 96 forks source link

[BUG] Testing cannot read route URI by name #34

Closed vafrcor closed 4 years ago

vafrcor commented 4 years ago

Version Information PHP Version: 7.2.1 Package Version (l5-api): v1.2.1

Describe the bug

namespace Tests\Api;

use Tests\ApiTestCase;

class UserTest extends ApiTestCase { public function doGetAll() { // $jsonResponse = $this->actingAsAdmin()->json('GET', '/api/users'); $jsonResponse = $this->actingAsAdmin()->json('GET', route('api.users.index', [], false));

    // Check status and structure
    $jsonResponse
        ->assertStatus(200);
}

}



**To Reproduce**
Steps to reproduce the behavior:
1. Go to project path
2. Run `phpunit`
3. See error

**Expected behavior**
Named route URI can be read on phpunit testing mode.

**Additional context**
Add any other context about the problem here.
specialtactics commented 4 years ago

Hi

The problem is actually with the dingo/api package, not this package.

However since you made this ticket that problem has also been resolved (I'm pretty sure), so just update your packages.

In any case, if you still face difficulties with this, please report to dingo/api github.