8000 Merge pull request #944 from koenwoortman/http_test_functions · laravel/lumen-framework@b5a8852 · GitHub
[go: up one dir, main page]

Skip to content

Commit b5a8852

Browse files
authored
Merge pull request #944 from koenwoortman/http_test_functions
[5.8] Http test functions
2 parents afbf45f + 1122b1b commit b5a8852

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src/Testing/Concerns/MakesHttpRequests.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ trait MakesHttpRequests
1919
protected $response;
2020

2121
/**
22-
* The current URL being viewed.
22+
* The current URI being viewed.
2323
*
2424
* @var string
2525
*/
@@ -152,6 +152,23 @@ public function option($uri, array $data = [], array $headers = [])
152152
return $this;
153153
}
154154

155+
/**
156+
* Visit the given URI with a HEAD request.
157+
*
158+
* @param string $uri
159+
* @param array $data
160+
* @param array $headers
161+
* @return $this
162+
*/
163+
public function head($uri, array $data = [], array $headers = [])
164+
{
165+
$server = $this->transformHeadersToServerVars($headers);
166+
167+
$this->call('HEAD', $uri, $data, [], [], $server);
168+
169+
return $this;
170+
}
171+
155172
/**
156173
* Send the given request through the application.
157174
*
@@ -311,6 +328,17 @@ protected function seeJsonContains(array $data, $negate = false)
311328
return $this;
312329
}
313330

331+
/**
332+
* Assert that the response doesn't contain the given JSON.
333+
*
334+
* @param array $data
335+
* @return $this
336+
*/
337+
protected function seeJsonDoesntContains(array $data)
338+
{
339+
return $this->seeJsonContains($data, true);
340+
}
341+
314342
/**
315343
* Format the given key and value into a JSON string for expectation checks.
316344
*

0 commit comments

Comments
 (0)
0