Skip to content

Commit

Permalink
Create a request method
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioribeiro authored and ifox committed Nov 18, 2019
1 parent 723f8c0 commit 0b75750
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions tests/integration/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private function configTwill($app)
$app['config']->set('twill.admin_app_path', 'twill');
$app['config']->set('twill.auth_login_redirect_path', '/twill');
$app['config']->set('twill.enabled.users-2fa', true);
$app['config']->set('twill.enabled.users-image', true);
}

/**
Expand Down Expand Up @@ -304,6 +305,42 @@ public function getAllUris()
->values();
}

/**
* Send request to an ajax route.
*
* @param $uri
* @param string $method
* @param array $parameters
* @param array $cookies
* @param array $files
* @param array $server
* @param null $content
* @param bool $followRedirects
* @return \Illuminate\Foundation\Testing\TestResponse
*/
public function request(
$uri,
$method = 'GET',
$parameters = [],
$cookies = [],
$files = [],
$server = [],
$content = null,
$followRedirects = true
) {
$request = $followRedirects ? $this->followingRedirects() : $this;

return $request->call(
$method,
$uri,
$parameters,
$cookies,
$files,
$server,
$content
);
}

/**
* Send request to an ajax route.
*
Expand All @@ -329,9 +366,9 @@ public function ajax(
'HTTP_X-Requested-With' => 'XMLHttpRequest',
]);

return $this->call(
$method,
return $this->request(
$uri,
$method,
$parameters,
$cookies,
$files,
Expand Down

0 comments on commit 0b75750

Please sign in to comment.