Last active
April 11, 2021 10:27
-
-
Save farindra/4ac293e3a3f7d3d111abc3cd6b7b69aa to your computer and use it in GitHub Desktop.
Lumen Jwtauth Part 1 - Test Endpoint
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
<?php | |
use Illuminate\Support\Facades\Config; | |
class EndpointTest extends TestCase | |
{ | |
/** | |
* unknown route shoult return 404 | |
* | |
* @return void | |
*/ | |
public function test_unknown_path_should_404() | |
{ | |
$request = $this->get('/any/random/endpoint'); | |
$request->response->assertJson([ | |
'error' => true, | |
])->assertStatus(404); | |
} | |
/** | |
* get version sholud return lumen version | |
* | |
* @return void | |
*/ | |
public function test_get_version() { | |
$this->get(route('v1.version')); | |
$this->assertEquals( | |
$this->app->version(), $this->response->getContent() | |
); | |
} | |
/** | |
* get ping should return pong | |
* | |
* @return void | |
*/ | |
public function test_ping_should_return_pong() { | |
$request = $this->get(route('v1.ping')); | |
$request->response->assertSee('pong')->assertStatus(200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment