Added more tests
This commit is contained in:
parent
20234f6a7c
commit
669fac6d3d
2 changed files with 14 additions and 14 deletions
|
@ -187,7 +187,7 @@ class Client
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) {
|
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) {
|
||||||
$len = strlen($header);
|
$len = strlen($header);
|
||||||
$header = explode(':', strtolower($header), 2);
|
$header = explode(':', $header, 2);
|
||||||
|
|
||||||
if (count($header) < 2) { // ignore invalid headers
|
if (count($header) < 2) { // ignore invalid headers
|
||||||
return $len;
|
return $len;
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ConsoleTest extends TestCase
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$session = $this->client->parseCookie($response['headers']['set-cookie'])['a-session-console'];
|
$session = $this->client->parseCookie($response['headers']['set-cookie'])['a-session-console'];
|
||||||
var_dump($response['headers']);
|
|
||||||
$this->assertEquals('http://localhost/success', $response['headers']['location']);
|
$this->assertEquals('http://localhost/success', $response['headers']['location']);
|
||||||
$this->assertEquals("\n", $response['body']);
|
$this->assertEquals("\n", $response['body']);
|
||||||
|
|
||||||
|
@ -81,26 +81,26 @@ var_dump($response['headers']);
|
||||||
/**
|
/**
|
||||||
* @depends testLoginSuccess
|
* @depends testLoginSuccess
|
||||||
*/
|
*/
|
||||||
public function xtestLogoutSuccess($data)
|
public function testLogoutSuccess($data)
|
||||||
{
|
{
|
||||||
|
var_dump($data);
|
||||||
$response = $this->client->call(Client::METHOD_DELETE, '/auth/logout', [
|
$response = $this->client->call(Client::METHOD_DELETE, '/auth/logout', [
|
||||||
'origin' => 'http://localhost',
|
'origin' => 'http://localhost',
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
'cookie' => 'a-session-console=' . $data['session'],
|
'cookie' => 'a-session-console=' . $data['session'],
|
||||||
], []);
|
], []);
|
||||||
|
|
||||||
var_dump($response);
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
$this->assertEquals('http://localhost/success', $response['headers']['location']);
|
$this->assertEquals('success', $response['body']['result']);
|
||||||
$this->assertEquals("\n", $response['body']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function testLogoutFailure()
|
public function testLogoutFailure()
|
||||||
// {
|
{
|
||||||
// $response = $this->client->call(Client::METHOD_DELETE, '/auth/logout', [
|
$response = $this->client->call(Client::METHOD_DELETE, '/auth/logout', [
|
||||||
// 'origin' => 'http://localhost',
|
'origin' => 'http://localhost',
|
||||||
// 'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
// ], []);
|
], []);
|
||||||
|
|
||||||
// $this->assertEquals('401', $response['body']['code']);
|
$this->assertEquals('401', $response['body']['code']);
|
||||||
// }
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue