laravel api phpunit 実行サンプル
laravel api phpunit 実行サンプル
http://localhost/xxxxxx/apis/echo
{ status : OK message : No problem }
>phpunit --color .¥tests¥SimpleApiTest.php
tests SimpleApiTest.php
<?php
class SimpleApiTest extends TestCase {
public function testEchoApi()
{
//call $this->clientは5から廃止された?
$response = $this->call( GET /apis/echo );
$this->assertEquals(200 $response->getStatusCode());
$obj = $response->getData();
$this->assertEquals( OK $obj->status);
$this->assertEquals( No problem $obj->message);
}
}
<logging>
<log type= json target= ./tests/results/logfile.json />
<log type= tap target= ./tests/results/logfile.tap />
<log type= junit target= ./tests/results/logfile.xml logIncompleteSkipped= false />
<log type= testdox-html target= ./tests/results/testdox.html />
<log type= testdox-text target= ./tests/results/testdox.txt />
</logging>