在布尔值上调用成员函数assertSessionHasErrors()

时间:2018-12-19 05:38:23

标签: curl phpunit-testing

当我尝试使用cURL进行phpunit测试时,出现了这样的错误     错误:在布尔值上调用成员函数assertSessionHasErrors()     这是我尝试从中检查电子邮件和密码的代码

<?php
namespace Tests\Unit;

use PHPUnit\Framework\TestCase;
class LoginTest extends TestCase
{ 
     public function testLogin(){

        $credentials = [
        'email' => 'admin@admin.com',
        'password' => 'password'
    ];

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL,"auth/login");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($credentials));

    $response = curl_exec($ch);
    $response->assertSessionHasErrors();

    }
}
?>

0 个答案:

没有答案