-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#12 - To fix the json structure bug with nested keys, also fixed the …
…calls to cater for the laravel seeJsonStructure not returning itself and failing.
- Loading branch information
1 parent
24d2896
commit ccdba10
Showing
5 changed files
with
49 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
<?php | ||
|
||
/** | ||
* Generated by OutlineTestGenerator on 2016-02-04 at 16:26:48. | ||
* Generated by OutlineTestGenerator on 2016-02-04 at 16:59:02. | ||
*/ | ||
class FeaturesTest extends TestCase | ||
{ | ||
|
||
public function testGet_Fetching_credits_available_Returns_200() | ||
{ | ||
$this->get("/status/credits", array ( 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', 'data', array ( 'credits_available', ), )) | ||
->assertResponseStatus(200); | ||
$call = $this->get("/status/credits", array ( 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', 'data', 'data' => array ( 'credits_available', ), )); | ||
$call->assertResponseStatus(200); | ||
} | ||
|
||
public function testGet_Fetching_credits_available_Returns_402() | ||
{ | ||
$this->get("/status/credits", array ( 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', 'data', array ( 'credits_available', 'min_threshold', ), )) | ||
->assertResponseStatus(402); | ||
$call = $this->get("/status/credits", array ( 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', 'data', 'data' => array ( 'credits_available', 'min_threshold', ), )); | ||
$call->assertResponseStatus(402); | ||
} | ||
|
||
public function testGet_Fetching_credits_available_Returns_401() | ||
{ | ||
$this->get("/status/credits", array ( 'Authorization' => 'Token WrongApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', )) | ||
->assertResponseStatus(401); | ||
$call = $this->get("/status/credits", array ( 'Authorization' => 'Token WrongApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', )); | ||
$call->assertResponseStatus(401); | ||
} | ||
|
||
public function testPost_Resending_a_code_Returns_200() | ||
{ | ||
$this->post("/code/resend", array ( 'client_user_id' => '12345', 'phone_number' => '27848118111', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', 'data', array ( 'verification_status', 'expires_at', array ( 'date', 'timezone_type', 'timezone', ), ), )) | ||
->assertResponseStatus(200); | ||
$call = $this->post("/code/resend", array ( 'client_user_id' => '12345', 'phone_number' => '27848118111', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', 'data', 'data' => array ( 'verification_status', 'expires_at', 'expires_at' => array ( 'date', 'timezone_type', 'timezone', ), ), )); | ||
$call->assertResponseStatus(200); | ||
} | ||
|
||
public function testPost_Resending_a_code_Returns_400() | ||
{ | ||
$this->post("/code/resend", array ( 'phone_number' => '27848118111', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', )) | ||
->assertResponseStatus(400); | ||
$call = $this->post("/code/resend", array ( 'phone_number' => '27848118111', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', )); | ||
$call->assertResponseStatus(400); | ||
} | ||
|
||
public function testPost_Resending_a_code_Returns_401() | ||
{ | ||
$this->post("/code/resend", [], array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token WrongApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', )) | ||
->assertResponseStatus(401); | ||
$call = $this->post("/code/resend", [], array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token WrongApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', )); | ||
$call->assertResponseStatus(401); | ||
} | ||
|
||
public function testPost_Resending_a_code_Returns_406() | ||
{ | ||
$this->post("/code/resend", array ( 'client_user_id' => '12345', 'phone_number' => 'someBadNumber', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', 'data', array ( 'required_format', ), )) | ||
->assertResponseStatus(406); | ||
$call = $this->post("/code/resend", array ( 'client_user_id' => '12345', 'phone_number' => 'someBadNumber', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', 'data', 'data' => array ( 'required_format', ), )); | ||
$call->assertResponseStatus(406); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
public function test{methodLabel}_{methodName}() | ||
{ | ||
$this->{method}("{endpoint}", {requestData}{requestHeaders}) | ||
{seeJsonStructure} | ||
->assertResponseStatus({statusCode}); | ||
$call = $this->{method}("{endpoint}", {requestData}{requestHeaders}); | ||
$call->{seeJsonStructure}; | ||
$call->assertResponseStatus({statusCode}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
<?php | ||
|
||
/** | ||
* Generated by OutlineTestGenerator on 2016-02-04 at 16:27:19. | ||
* Generated by OutlineTestGenerator on 2016-02-04 at 17:01:12. | ||
*/ | ||
class FeaturesTest extends TestCase | ||
{ | ||
|
||
public function testGet_Fetching_credits_available_Returns_200() | ||
{ | ||
$this->get("/status/credits", array ( 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', 'data', array ( 'credits_available', ), )) | ||
->assertResponseStatus(200); | ||
$call = $this->get("/status/credits", array ( 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', 'data', 'data' => array ( 'credits_available', ), )); | ||
$call->assertResponseStatus(200); | ||
} | ||
|
||
public function testGet_Fetching_credits_available_Returns_402() | ||
{ | ||
$this->get("/status/credits", array ( 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', 'data', array ( 'credits_available', 'min_threshold', ), )) | ||
->assertResponseStatus(402); | ||
$call = $this->get("/status/credits", array ( 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', 'data', 'data' => array ( 'credits_available', 'min_threshold', ), )); | ||
$call->assertResponseStatus(402); | ||
} | ||
|
||
public function testGet_Fetching_credits_available_Returns_401() | ||
{ | ||
$this->get("/status/credits", array ( 'Authorization' => 'Token WrongApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', )) | ||
->assertResponseStatus(401); | ||
$call = $this->get("/status/credits", array ( 'Authorization' => 'Token WrongApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', )); | ||
$call->assertResponseStatus(401); | ||
} | ||
|
||
public function testPost_Resending_a_code_Returns_200() | ||
{ | ||
$this->post("/code/resend", array ( 'client_user_id' => '12345', 'phone_number' => '27848118111', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', 'data', array ( 'verification_status', 'expires_at', array ( 'date', 'timezone_type', 'timezone', ), ), )) | ||
->assertResponseStatus(200); | ||
$call = $this->post("/code/resend", array ( 'client_user_id' => '12345', 'phone_number' => '27848118111', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', 'data', 'data' => array ( 'verification_status', 'expires_at', 'expires_at' => array ( 'date', 'timezone_type', 'timezone', ), ), )); | ||
$call->assertResponseStatus(200); | ||
} | ||
|
||
public function testPost_Resending_a_code_Returns_400() | ||
{ | ||
$this->post("/code/resend", array ( 'phone_number' => '27848118111', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', )) | ||
->assertResponseStatus(400); | ||
$call = $this->post("/code/resend", array ( 'phone_number' => '27848118111', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', )); | ||
$call->assertResponseStatus(400); | ||
} | ||
|
||
public function testPost_Resending_a_code_Returns_401() | ||
{ | ||
$this->post("/code/resend", [], array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token WrongApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', )) | ||
->assertResponseStatus(401); | ||
$call = $this->post("/code/resend", [], array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token WrongApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', )); | ||
$call->assertResponseStatus(401); | ||
} | ||
|
||
public function testPost_Resending_a_code_Returns_406() | ||
{ | ||
$this->post("/code/resend", array ( 'client_user_id' => '12345', 'phone_number' => 'someBadNumber', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )) | ||
->seeJsonStructure(array ( 'status', 'message', 'data', array ( 'required_format', ), )) | ||
->assertResponseStatus(406); | ||
$call = $this->post("/code/resend", array ( 'client_user_id' => '12345', 'phone_number' => 'someBadNumber', ), array ( 'Content-Type' => 'application/json', 'Authorization' => 'Token ApiKey1234', )); | ||
$call->seeJsonStructure(array ( 'status', 'message', 'data', 'data' => array ( 'required_format', ), )); | ||
$call->assertResponseStatus(406); | ||
} | ||
|
||
} |