0
응용 프로그램/컨트롤러/SecurityController.php단위 테스트 laravel 4 컨트롤러 통과 JSON 페이로드
class SecurityController extends Controller {
public function login()
{
$payload = file_get_contents("php://input");
$payload = json_decode($payload);
$input = array('mail' => $payload->mail,
'password' => $payload->password,
);
if (Auth::attempt($input))
{
}
}
}
응용 프로그램/테스트/SecurityTest.php
class SecurityTest extends TestCase {
public function testLogin()
{
$data = array(
'mail' => '[email protected]',
'password' => 'mypasswprd',
);
$crawler = $this->client->request('POST', '/v2/login', $data);
}
내가이 오류를 받고 있어요 phpunit을 실행하면 : { "error": { "type": "ErrorException", "message": "객체가 아닌 속성을 얻으려고 시도 중", "file": app/controllers/SecurityController.php ","line ": 20} }
가 지금까지를 디버깅하는 노력을 기울 적이 있습니까? 너 무슨 짓을 한거야? –
컨트롤러가 빈 페이로드를 수신하고 있습니다. – mookofe