One of the clearest tutorials I've ever seen about dependency injection and mocking. Thank you guy for the time you dedicated to this series, and go on!
@ProgramWithGio2 жыл бұрын
Thank you, glad you like it 🙏
@jaWitold2 жыл бұрын
Great tutorial, in less than 20 minutes i understood things that at my university i couldn't understand in half a year. Thank You.
@ProgramWithGio2 жыл бұрын
That's awesome, thank you 💙💙
@janedawg097 ай бұрын
it's a huge help that your tuts are well divided for each topics. I haven't the time to watch all so I watch the ones I needed at the time and it helps a lot since your explanation and examples are well executed too
@ProgramWithGio7 ай бұрын
Happy to hear
@johnp61153 жыл бұрын
Your videos on testing have been a huge help, thanks.
@ProgramWithGio3 жыл бұрын
Glad to hear that 👍
@joseph_oluwayomi2 жыл бұрын
Thanks for this intro. It will go a long way to helping me understand and write tests better.
@ProgramWithGio2 жыл бұрын
You are welcome
@wesammohammed181923 сағат бұрын
Great job ! Thank you form gaza شكرا جزيلا لك
@MansoorKhan-ns2bt3 жыл бұрын
Great tutorial. Finally, I am able to understand Mocking. Thank you, Gio. Love your content.
@MansoorKhan-ns2bt3 жыл бұрын
Could we expect a series on TDD / PHPUnit on an advanced level? Would love to see that.
@ProgramWithGio3 жыл бұрын
Thank you Mansoor. Really glad to hear that. I personally don't do TDD so not sure if I would make a series on it. But I might make a separate series on phpunit.
@longtran123456782 жыл бұрын
very clear, precise, this video is gold. Thank you very much. This helps me a ton while applying tests to our legacy products. I wish I can like this several thousand times.
@ProgramWithGio2 жыл бұрын
Thank you, glad it was helpful 💙
@yuriymiroshnychenko54462 жыл бұрын
The best explanation of Mocking I have seen! Thank you for you videos!
@ProgramWithGio2 жыл бұрын
Thank you 🙌
@harshshah84203 жыл бұрын
This is what exactly I was looking for. :) I really appreciate it. Life saver!!!
@Zubbee2 жыл бұрын
Was able to go through this lesson regardless. I'm pressing on. . I'm real glad to have this lesson. I may never have come across this by now if I was still trying to learn PHP the way I was learning before. Thanks alot Gio.
@ProgramWithGio2 жыл бұрын
Awesome, thank you 💙
@SouravRakshit_srv3 жыл бұрын
want more in this testing series. great content 👍
@ProgramWithGio3 жыл бұрын
Thank you 🙌
@invgreat5608 Жыл бұрын
Love your channel!!
@ProgramWithGio Жыл бұрын
Thank you so much!
@walis853002 жыл бұрын
Thanks for the explanation, it is now clear for me how to mock in PHPUnit!
@ProgramWithGio2 жыл бұрын
Great to hear
@parijke3 жыл бұрын
Awesome!
@ProgramWithGio3 жыл бұрын
Thanks
@gracjankubicki70043 жыл бұрын
Great job ! I wait for next videos ;D
@ProgramWithGio3 жыл бұрын
Thank you
@thisisthelogic2 жыл бұрын
Your content is pure gold!
@ProgramWithGio2 жыл бұрын
Thank you
@Vitalii-m6r Жыл бұрын
Excellent! Thanks for this extremely useful PHP series!
@ProgramWithGio Жыл бұрын
Thank you
@n8finch Жыл бұрын
Awesome, super clear, better than the PHPUnit docs! 😂 Thank you!
@ProgramWithGio Жыл бұрын
Thank you 🙌
@bijianwu51242 жыл бұрын
explained in detail and clearly! Thanks for it
@ProgramWithGio2 жыл бұрын
You're welcome 🙌
@ntdash21532 жыл бұрын
the change in voice was noticable XD
@ProgramWithGio2 жыл бұрын
🙊🙊
@amarjanovic9893 жыл бұрын
Thank you very much for this.
@ProgramWithGio3 жыл бұрын
You're welcome 🙌
@WhiteSiroi2 жыл бұрын
so helpful, thank you Gio
@ProgramWithGio2 жыл бұрын
Glad to hear, you're welcome
@windsurf172 жыл бұрын
Fantastic!!!
@ProgramWithGio2 жыл бұрын
Many thanks!
@wotizit3 жыл бұрын
Awesome
@federicobau86512 жыл бұрын
great video for PHP unit
@ProgramWithGio2 жыл бұрын
💙💙
@aruppaul14683 жыл бұрын
thanks bro
@ProgramWithGio3 жыл бұрын
You're welcome 🙌
@ClawHammer233 жыл бұрын
Great video.....thanks so much
@ProgramWithGio3 жыл бұрын
Thank you
@benderbg3 ай бұрын
Eminem has a song called Mockingbird and it has an intro that says: " I know sometimes things may not always make sense to you right now" So Eminem was teaching us about mocking before Gio did!
@ProgramWithGio3 ай бұрын
good one :D
@donmikele072 жыл бұрын
I'm coding for years and I watched a lot of tutorials but I must say this is something very different, very serious, and very experienced. Great job man! BTW: do you have any recommendations for some tutorials with examples for writing more complex tests with Mockery (besides the official documentation for which you've already put the link in the description)?
@ProgramWithGio2 жыл бұрын
Thank you 💙. I don't have any recommendations at the moment. I would say check Laracasts they have a lot of testing related lessons
@AlbertAngmor2 жыл бұрын
I agree. I really agree. No rambling. Straight to the point, understandable and packed.
@shahrokhmoghimi4230 Жыл бұрын
Thank you Man, I believe your tutorial is the best PHP tutorial I have seen, but I should say It would not be better if you said that static methods cannot be tested ;)
@shahrokhmoghimi4230 Жыл бұрын
and about solving it, we should refactor static methods to non-static for testing. I think the addition of this topic will make your excellent education more attractive
@ProgramWithGio Жыл бұрын
@@shahrokhmoghimi4230 thank you. I talk about disadvantages of static methods in another lesson where we discuss static. We don't have any static methods in this lesson so not sure what you mean.
@shahrokhmoghimi4230 Жыл бұрын
@@ProgramWithGio Thank you for your fast feedback, I know and I have almost seen your all of tutorial :), I mean, it would be better that you mention it in this lesson because it possible anyone is reached straight to this lesson (or previous lesson) with search. like me several months ago :)
@memack1012 жыл бұрын
Thank you.
@ProgramWithGio2 жыл бұрын
💙
@SaiyanJin85 Жыл бұрын
That's a good one. Just a thought though, I find that creating a dummy class that extends the dependency works better than using a mocking library 1. it's easies since you don't have to learn any extra mocking library 2. it's safer because if for some reason you change the name of a method of the original class in this case from 'charge' to 'pay' for example the test will still pass because of how mocking libraries works. Having a simple dummy class extending the original will force you to update the dummy class too I think Any thoughts on that?? Thanks!
@ProgramWithGio Жыл бұрын
Yea sure, in some cases it can be better & easier. About changing method name it depends how you use mocking, if you are expecting a method call with name charge in your mock it will fail if you change method name to something else and it doesn't get called
@SaiyanJin85 Жыл бұрын
@@ProgramWithGio Thanks for your quick reply! Also there is the issue of the readability of the test. For simple mocks it's ok but it can get really messy and unreadable for more complex dependencies
@ProgramWithGio Жыл бұрын
@@SaiyanJin85 yup. Sometimes simple dummy class is all that's needed
@rushko75 Жыл бұрын
Thank you
@ProgramWithGio Жыл бұрын
You're welcome
@alexandrbisir3784 Жыл бұрын
Thank you so much for putting such amazing contents!! I'm new to unit test. so if there is a private dependency function inside public function charge(), how can we mock the private method? Thank you in advance!!!
@ProgramWithGio Жыл бұрын
Ideally, you shouldnt be testing private methods on its own but test the underlying method that calls or depends on that private method. If your private method is too complex and you must have a test for it then you could try with reflection API or extract the private method into a separate class & have test for that class
@aerohcss2 ай бұрын
Gio, I'm a bit confused about concepts. Am I right that general name for all fake classes are Mock objects that in turn can have fixed output ("to stub") or do output via expectations ("to mock")?
@ProgramWithGio2 ай бұрын
Yes pretty much
@redzambala619311 ай бұрын
I am at 5:15 min now trying to run test, I am geting an error: Error: Class "services\SalesTaxService" not found; and indeed - it is mentioned in InvoiceService but does not exist; and what should I do?! I believe it never existed in this course, or am I missing something?
@ProgramWithGio11 ай бұрын
Its in the repository source code (link in description). Simply copy it & create it on your end
@nicolaeifrim38011 ай бұрын
Thank you. What happens if the function we are testing is a static function and is full with calls to other static methods (some within the same class)?
@ProgramWithGio10 ай бұрын
One of the reasons why I avoid statics is because its harder to write tests for it
@nicolaeifrim38010 ай бұрын
@@ProgramWithGio Yes, I had to refactor the entire code.
@beticohernandez95363 жыл бұрын
Hi there. Will you make a project with php?
@ProgramWithGio3 жыл бұрын
Yes towards the end of the series
@johongirrahimov23433 жыл бұрын
Hi Gio, I've a question. I want to learn Laravel after completing all of these series. What do you think should I learn more PHP after I complete this course or is this enough for learning Laravel?
@ProgramWithGio3 жыл бұрын
Hello! You could start learning Laravel even now. Laracasts is great resource
@johongirrahimov23433 жыл бұрын
@@ProgramWithGio thanx a lot for the answer
@ProgramWithGio3 жыл бұрын
@@johongirrahimov2343 you're welcome 👍
@Darkray2012 жыл бұрын
Thank you for this video, Gio! Could you please add timestamp marks like you did in part 1 to split up the video into units of meaning / categories? Thanks :) Another point to consider is to use native PHP 8 attributes instead of PHP Annotations
@ProgramWithGio2 жыл бұрын
Thank you. I usually add timestamps to videos where it makes sense if I cover multiple topics. As for attributes I use them in places where it is available. Don't think phpunit supports them yet unless I missed it in the documentation
@Darkray2012 жыл бұрын
@@ProgramWithGio Yes, I discovered this also right now. For others wondering: ETA of PHPUNIT 10 is February 2023. With PHPUnit 10 PHP8.1 compatibility will come to us.
@carnaqe115411 ай бұрын
what is the difference between the customer array placed in as rvalue and other time as lvalue at the end of the video?
@ProgramWithGio10 ай бұрын
Not sure what you mean, can you point at timestamps?
@bakosyy Жыл бұрын
So, if we write tests after creating business logic, is it behavior driven development or what?
@ProgramWithGio Жыл бұрын
dont know if there is a term for that but I dont think its BDD
@baptistedara80262 жыл бұрын
Sir, I don't understand why sleep function didn't work when we call a method on mocked dependency
@ProgramWithGio2 жыл бұрын
Because it was mocked, the original function didnt execute, function on mocked class did.
@baptistedara80262 жыл бұрын
@@ProgramWithGio thanks you
@adrianosilveira44292 жыл бұрын
When I try to use ->expects in a class created from ->createMock it says that it doesn't exists. What should I do?
@ProgramWithGio2 жыл бұрын
Can you share screenshot or github link to your code so I can check it out?
@adrianosilveira44292 жыл бұрын
@@ProgramWithGio hello my friend. Thank you for your answer, it turns out it was a problem with my php plugin in vscode. I've switched to PHP storm and the problem disappeared. Thank you again for the amazing tutorials and your kindness
@ProgramWithGio2 жыл бұрын
@@adrianosilveira4429 Awesome, glad it worked out. Thank you for your support
@b4rt1j12 жыл бұрын
Hi, may i ask how to test private or protected methods?
@ProgramWithGio2 жыл бұрын
Either test the method that calls it or use reflection
@akhileshkumar-iu9uq3 жыл бұрын
Hi sir, I have seen your vdos and manage my whole project from procedure php to oops. I have 4 years of experience in this backend web development, should I change this field
@ProgramWithGio3 жыл бұрын
Hello! If you enjoy what you do then I would say no. PHP is on demand and will be on demand for as long as it runs most of the web
@akhileshkumar-iu9uq3 жыл бұрын
@@ProgramWithGio I will do that. Thanks for your guidance. I m from India. My target is to get job overseas.
@ProgramWithGio3 жыл бұрын
@@akhileshkumar-iu9uq you're welcome. Good luck 🤞
@DigitaSkills1012 жыл бұрын
How many frameworks and libraries do you know about
@ProgramWithGio2 жыл бұрын
I haven't counted it & don't plan to count it :). I learn things as I need them.
@omaryahia Жыл бұрын
thanks ^_^
@ProgramWithGio Жыл бұрын
You're welcome
@TITAN-sv5eg Жыл бұрын
after i test the code with phpunit i should delete the test files? please i want a answer
@ProgramWithGio Жыл бұрын
No you shouldn't remove it, tests are there so that you can test them continuously, especially after making changes or refactoring the method that you are testing.
@TITAN-sv5eg Жыл бұрын
@@ProgramWithGio Thanks, i have a problem => undefined method 'method' what i do
@ProgramWithGio Жыл бұрын
@@TITAN-sv5eg can't really help you without seeing the code, put it up in GitHub and share the link to the repo and I can check it out.
@manzurahammed70512 жыл бұрын
Facing problems when trying to call the same mock method with a different arguments
@ProgramWithGio2 жыл бұрын
What problems are you facing? Feel free to DM me on Twitter & I'll help troubleshoot it
@samuelaniogbu5089 Жыл бұрын
Gio is php documentation simplified
@ProgramWithGio Жыл бұрын
Heh thank you
@truthteachers Жыл бұрын
Bro, i have some problems. I notice that this video is not the continuation from lesson 3.1 as it contains new classes. I reverted to your repo which contains the course material and found that Services/InvoiceService class is not the same. Please advise.
@ProgramWithGio Жыл бұрын
Hey, yes this is the continuation, the classes might be a bit different because the lesson is different. I added the InvoiceService class specifically for this lesson to learn about mocks.
@dev_troy890310 ай бұрын
For the email test, I tried to not specify the with method, and it worked. I think we don't need to test the arguments it's enough that the "send" method is called. what do you think Gio ?? Thanks for the great content 🤍
@ProgramWithGio10 ай бұрын
That's ok. It mainly depends on what exactly you are testing, if all you care about to test if send method is called then its fine, if you want to test with specific arguments then you would write test to handle that as well