It's been 8 years since I started working with Laravel, leading a team of senior developers and now running my own SAAS business built on Laravel. Still, when I see a new Laravel-related video, especially from its maintainers, it gives me a next level of satisfaction. Thank you so much, Laravel team, for building and maintaining this amazing framework. ❤❤❤❤❤❤❤❤❤❤❤
@LaravelPHP4 ай бұрын
That's an incredible journey. Thank you for sharing. :) Keep up the great work! -Josh
@CharlesMartel8294 ай бұрын
I've got a master in applied statistics and one of the first things a professor said in my first statistics class when another student asked him about a simple significance test was "I don't know".
@LaravelPHP4 ай бұрын
Sounds like a professor I would have loved! :) -Josh
@Xewl4 ай бұрын
A teacher to acknowledge that he doesn't know something, is better than one that doesn't (:
@JonBrookes3 ай бұрын
thanks for this Josh, not nearly enough is said of testing and seeing your fresh take on Laravel testing is most welcome. Your approach is a good one in that your helping all to use tests and in a way that is encouraging and uncomplicated, so we all need to do tests now 🚀🚀
@LaravelPHP3 ай бұрын
So glad that this was helpful Jon. I've already written more tests since this video! ☺️ -Josh
@ReyhanJoseph4 ай бұрын
i started watching you for laravel but you saying you never tested in Laravel just makes me more intrigued lol to learn so you got me hooked lol
@LaravelPHP4 ай бұрын
I'll take it. 😂 -Josh
@ronaldngarombo10264 ай бұрын
I started learning testing yesterday, from the Laravel docs 😁
@LaravelPHP4 ай бұрын
Hey me too! :) -Josh
@mike-23424 ай бұрын
This is really good. Too often our industry just feigns competence in literally everything.
@LaravelPHP4 ай бұрын
I'm glad you agree. I think there's a lot we all can learn when we realize that there's SO MUCH to learn. :) -Josh
@dajoeberlei4 ай бұрын
I love testing. Allthough im often falling into the pithole of "i quickly need to write that feature, ill test it later" cause im kinda in the need of delivering fast often. I think even with taking the extra time of writing the tests it probably often would even save time but i dont actually know. Do you guys know that mindset and have you broken that cycle? And if so how? I find myself very often I a bug situation later on where i think "If i only had written a test back then, that wouldn't have happen"
@LaravelPHP4 ай бұрын
Hopefully others can chime in, but I can say as someone who now wants to write tests for features I have written in the past, I think testing is a great way to get you to stop and think about what a particular page/feature/components needs to be able to do before you even test it on the page. I think that's going to be my approach from now on: - Write the Livewire logic - Write a test - Write the front-end - Test it from the UI But... I'm still learning. :) -Josh
@Pekz00r4 ай бұрын
Yes, that heppens to me a lot as well. I also really don't like the TDD approach because it feels so backwards and you often don't know exactly how the solution should work before you start. I find that unit tests are usually not really needed and can often be a waste of time. I prefer feature tests and E2E testing in most cases. Unit tests are great for some critical parts of the application where it needs to be exactly right. For example price calculations or payment flows.
@darylphuah4 ай бұрын
If you fully write the feature, you'll never write the test. For one, you've "done" your work, so a test now feels like a waste of effort. Secondly, because you already implemented the code, you know too much and will end up polluting your test with implementation details that it shouldn't know about; making it a bad test. you need to go somewhat 50-50. 1. Write the first few high level abstractions of the code and its flow. You're not writing any implementation details yet, just what input/outputs and functions are being called. 2. Identify the critical paths you need to test for in the code (You might not need to test everything) 3. Write the tests, they should all fail because none of the code for it actually exists yet. 4. Start writing the code, starting from unit test level up to the feature level. This way is far more natural than the strict TDD approach. You've already mapped out the shape/flow of your code, then now you're using tests to ensure that when you implement it, you don't miss or f`k up anything else.
@CaimAstraea4 ай бұрын
I tried to apply testing also but seems I have to fight the framework to make tests like other teams in my company do :( They're pretty much mocking every every thing in the framework from model , eloquent , the query builder etc. Not sure if these tests are correct but feels like a pain in the arse to write tests like this. Sure you can also make a test sqlite but I feel this is not the correct way to "unit test" ... I dove down deep the rabbit hole and things got very very academical and complex to the point I gave up. Apparently you can do something like a repository pattern and build on top of the laravel model and that makes it easier to unit test but I have no idea how. Every tutorial or article barely scratches the surface of this. I need a concrete actual good practice example which I couldn't find for the past 2-3 years.
@jebiboy4 ай бұрын
I'm also new to phpunit test. If you're going to do some refactoring from your old module, will you just modify your old feature test or create a new feature test and delete the old feature test?
@LaravelPHP3 ай бұрын
I think you can just modify your old feature test. But it might be helpful to have them up side by side since that way you know one works. :) -Josh
@stefanilic41784 ай бұрын
I love your videos, it's always so interesting. Keep it up! :) Can you tell which theme and icon theme you are using in vs code?
@jalancarimakan5074 ай бұрын
i second this!
@LaravelPHP4 ай бұрын
Thank you for the support! :) This is the Catppuccin Frappe theme and icon theme in VS Code. -Josh
@astroshah83784 ай бұрын
Which code editor is it? Looks lot simpler to be VS code
@LaravelPHP4 ай бұрын
This IS actually VS Code. :) I have a video on my personal channel of how I set it up and some of the configuration. -Josh
@compton83014 ай бұрын
Thanks
@LaravelPHP4 ай бұрын
Thanks for watching. :) -Josh
@codewithsub50834 ай бұрын
Can you please share your vacode config? Theme Font Icon theme
@LaravelPHP4 ай бұрын
This is the Catppuccin Frappe theme and Icon theme. And then Dank Mono for the font. :) -Josh
@codewithsub50834 ай бұрын
@@LaravelPHPthank you so much ❤
@rafamorawiec4 ай бұрын
I always thinking about every possible scenario to testing and I never can say "it's enough" and it ends with "ok, i'lll do tests later" (yeah, sure...) :(
@LaravelPHP4 ай бұрын
See, my previous thoughts were always along the lines of, "It's just me so I don't need to do them. :)" Boy was I wrong. Testing could have saved me tons of time in some scenarios. -Josh
@dominikbetlej71144 ай бұрын
Nicee! Thx!
@LaravelPHP4 ай бұрын
Thanks for learning with me. :) -Josh
@ricko134 ай бұрын
brb 9:40
@kennethlau81084 ай бұрын
Second
@LaravelPHP4 ай бұрын
👋 Glad to have you here to watch the testing newbie. ;D -Josh
@fahnleindieselschweif50224 ай бұрын
Fun fact: Pest is the german word for plague. Maybe testing is just that?
@LaravelPHP4 ай бұрын
Uh oh. 👀 -Josh
@Pekz00r4 ай бұрын
Yes, same in Swedish. It is pretty weird.
@Xewl4 ай бұрын
It's a play on Jest (the testing framework for JavaScript), but for PHP. "PHP Jest" -> Pest PHP, Pest. OfferZen made a video about it, feat Nuno himself: kzbin.info/www/bejne/ipXXe5-rhdOfbKc
@mr.mike6784 ай бұрын
Real men test in production
@LaravelPHP4 ай бұрын
Not me anymore. 😁 -Josh
@giropa4 ай бұрын
Clients don't want to pay extra for testing; it's usually better to wait for the error to appear.
@Pekz00r4 ай бұрын
They prefer errors in production and developers spending even more time with manual testing? The clients are not always right, especially not in our field. As the expert you need to tell them what is best.
@Xewl4 ай бұрын
I agree with @@Pekz00r here. It's your choice, not theirs. It's your value that you can give to them. If they don't want that value, you have to make sure they understand the higher possibility of future follow-ups and (far) more costs to come when it ultimately fails. It's not only a fail-save for you, but also for them.
@andyhinkle4 ай бұрын
Disagree. It might seem cost-effective to wait for errors to appear, this can lead to larger issues down the line, such as unexpected downtime, loss of data, or compromised security.
@LaravelPHP4 ай бұрын
I think in addition to what has been mentioned above, once a team has a flow for testing and creating features, you can build features faster too which the client is ALL for. :) -Josh
@Cronay4 ай бұрын
I would never mention tests to clients, either they hire me because they trust me to deliver a good project or not. If they explicitly state I'm not allowed to write tests, I'm not to be hired. Testing saves me time and doing TDD doesn't drain my brain as much with complex logic as when I'm not writing any tests. It's a safety net I'm building for myself to not introduce bugs when changing code later. Currently maintaining a code base and each day a failing tests saves me from introducing new bugs and unwanted behaviour when working on some new requirements.