如何通过单元测试保存数据

时间:2019-04-11 05:04:30

标签: laravel

我正在测试测试中的保存数据功能,但是当我运行测试代码时,它显示此错误

1) Tests\Unit\UserTest::testStore
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://localhost/user'
+'http://localhost'

这是我的考试:

$response = $this->withoutMiddleware();
        $createUser = [
            '_token' => 'jhjuiuswktHPyZOvreZDwhcX32XfwvL1onFKm',
            'name' => 'john',
            'email' => 'john@gmail.com',
            'password' => 'randomstring',
            'confirm_password' => 'randomstring',
        ];

        $response = $this->post('/user/store', $createUser)->assertLocation('/user');

0 个答案:

没有答案