Unit testing 未定义的方法FatalThroTableError::getStatusCode()-测试Laravel 5.2
我开始研究测试,所以我想做一些简单的事情,比如看看页面是否正确加载 这是我的测试Unit testing 未定义的方法FatalThroTableError::getStatusCode()-测试Laravel 5.2,unit-testing,laravel-5,Unit Testing,Laravel 5,我开始研究测试,所以我想做一些简单的事情,比如看看页面是否正确加载 这是我的测试 <?php use App\Users\Models\User; class BlogPostsTest extends TestCase { protected $baseUrl = 'http://localhost:8000'; public function testBlogPostsAreAccessible() { $this->be( Use
<?php
use App\Users\Models\User;
class BlogPostsTest extends TestCase {
protected $baseUrl = 'http://localhost:8000';
public function testBlogPostsAreAccessible()
{
$this->be( User::findOrFail(1) );
$response = $this->call( 'GET', '/admin/blog-posts' );
$this->assertEquals( 200, $response->getStatusCode() );
}
}
您确定您的“管理员/博客帖子”返回实际响应对象吗?您能在测试中添加输出吗?因此:
dd($response);
看看你的代码返回了什么