Laravel 5.1 have been released. But I don't know how to use it's testing features because I'm still new with TDD stuffs.
For example, I want to test my Eloquent Model (relationships etc.) Anyone could explain with clear explanation? Thanks in advance
There is a couple of type of testing we have in the world, What I would suggest you do is to write a unit test, for example, let's say you have users and posts table and you want to test the relationship.
$user = factory(User::class)->create();
$post = factory(Post::class)->create(['user_id'=>$user_id]);
$this->assertEqual(1, $user->posts->count());
This way you have tested the relationship between user and posts.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.