-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Whenever I try to test an API endpoint in my Lumen 5.3 setup the requests response has the error The version given was unknown or has no registered routes.
.
I seems to occur with all kind of requests executed in tests.
I can confirm the following request methods, which all have the same error response
$this->post();
$this->get();
$this->put();
$this->JSON();
Here's one complete test
use Laravel\Lumen\Testing\DatabaseTransactions;
class AdministrationsTest extends TestCase
{
use DatabaseTransactions;
public function test_create_administrations()
{
$response = $this->post('api/administrations', [
'label' => 'Administration 1'
], ['Accept' => 'application/json']);
// The error is in the response here
dd($response->response->getContent());
$this->seeInDatabase('administrations', ['label' => 'Administration 1']);
}
}
Here's my phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/app.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">app/</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="API_PREFIX" value="api"/>
<env name="API_DOMAIN" value="*censored*"/>
<env name="API_DEBUG" value="true"/>
<env name="API_STRICT" value="false"/>
<env name="API_DEFAULT_FORMAT" value="json"/>
</php>
</phpunit>
Metadata
Metadata
Assignees
Labels
No labels