PHPUnit in Laravel: Simple Example of Why/How to Test

preview_player
Показать описание
Here, I'm showing WHY we need unit-testing and how beneficial it is, in order to avoid bugs. Together, we write tests for existing feature, then refactor that feature, find a bug, and make sure that tests are working again.

- - - - -
Рекомендации по теме
Комментарии
Автор

This is why you should always write your test before coding. Great work!

Atiradeonvideo
Автор

This is what I'm looking for, hoping to see more of these. Thanks, Laravel Daily for sharing your daily knowledge. Godbless.

kelvezu
Автор

I usually go with the repository pattern, injecting a repository interface into the service and at the Unit test I use a mock of that to get data from the "database". According to Uncle Bob a Unit Test should be able to work either you have a database or not having one. Also by randomly generating data you can not be sure in every test what the outcome will be. Maybe works in this case but if you wanted to check the total amount of a period it would not work unless you insert specific data to test. Anyway, I really like your videos, there are very helpful.

tkouleris
Автор

It was one of the best I have seen till now. Thanx man. Good job

resan
Автор

Great Work so simple and easy to be understood 🙌

takieddine
Автор

Thankyou for making it simple and clear!

SreekalaA
Автор

Awesome! Very well explained, thanks!

giuseppeloarte
Автор

I learned so much from your channel! Thank you! Here's hoping I ace the Laravel coding challenge for a job im applying for.

outofboundsbro
Автор

Wow, this is so informative and elaborate. Thanks!

mrsakurai
Автор

Thank you very much for great tutorial video!

ShinjaeKang
Автор

Thanks for the video. Waiting for more videos in this and services.

ajithlal
Автор

it so simple and easy to be understood. nice video.

asepookurniawan
Автор

Wow! Thank You! That was very informative

franeklubi
Автор

thank you sir.. this is really good and helpful tutorial

ghazyy
Автор

This was a good example... Loved it... Could you share the difference between Unit and Feature tests?? There is a lot of wrong asumptions out there.

JohnnyBigodes
Автор

what css framework did you use for this lesson?

edpogi
Автор

I remember doing unit tests on sqlite and dev running on mysql

raimonds.L
Автор

Hi Povilis. Do you know any "trick" to clone a database as you mention? I have a production database and I want to start testing with a clean database as you mention in the video! (I have no migrations as is a legacy project)

manuelregidor
Автор

Hi, I have a lot of code in my controller/index, which builds me a json api from all kinds of joined tables. Is there a way to assert if all the json data is provided, that is required by the frontend, and return some error if any of these json items aren't accessible? It would be easier to test like that rather than always swap between the frontend and the backend for errors. Thank you.

dgloria
Автор

How are tests are performing so fast ?
On my local it takes lots of time to load phpunit and then runs test
Please help

harshittamrakar