PHP Unit Testing - PHPUnit Tutorial - Full PHP 8 Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ธ.ค. 2024

ความคิดเห็น • 140

  • @AnonymousDeveloper1
    @AnonymousDeveloper1 2 ปีที่แล้ว +8

    I need to dive into this channel because it seems to have quality PHP related stuff. Really good job!

  • @mwaas
    @mwaas ปีที่แล้ว +6

    One of the amazing things about this course is the deep and behind the scenes explanation.
    If programming courses are minerals then this course is a Diamond

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +3

      Thank you for kind words buddy 🙌

  • @chrisodillman3355
    @chrisodillman3355 ปีที่แล้ว +5

    You are the best programming teacher i ever had! Thank you so much!!!

  • @ilyaslabukarov5959
    @ilyaslabukarov5959 2 ปีที่แล้ว +7

    Thank you so much!
    You are literally changing the world into a better place!

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      That's great to hear, thank you 💙

  • @sadhakbj
    @sadhakbj 3 ปีที่แล้ว +20

    The contents of this channel are on next level. You videos inspire me alot, more and more to study the core PHP and I get amazed with the beauty of PHP.

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +4

      I'm really glad to hear that. Thank you 🙏

  • @ahmedamshir3925
    @ahmedamshir3925 3 ปีที่แล้ว +5

    Your content is very very great, you talk about things no one has mentioned before.
    Keep going Gio

  • @RandallNewman
    @RandallNewman ปีที่แล้ว

    Gio you are a great teacher. No need to increase the speed on these vids. Well done.

  • @Zubbee
    @Zubbee 2 ปีที่แล้ว +3

    Other issues related to my personal life have forced me to be a lot slower in my advancement through these courses, but I believe they would be sorted and allow me to continue to advance at a better pace. Testing sure is advanced stuff. I'm delighted to be having all these exposures. Thanks a lot Gio, even for the extra help you give personally. God bless

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      You're welcome. Hope everything is ok 💙

    • @Zubbee
      @Zubbee 2 ปีที่แล้ว

      @@ProgramWithGio yeah. I should be back to pace before the end of the week.

  • @DigitaSkills101
    @DigitaSkills101 2 ปีที่แล้ว +1

    Your tutorials are proofs why php is most used language

  • @joseph_oluwayomi
    @joseph_oluwayomi 2 ปีที่แล้ว +1

    I’m loving this. Writing tests is the major skill I’m trying to build to have all the confidence I crave. Thanks 🙏

  • @danabooysen4672
    @danabooysen4672 10 หลายเดือนก่อน

    This channel is offering quality material worth your time. Thank you Gio. The only drawback since the content is mostly training related all topics are rushed through and hard to follow along especially when learning something new. The speach is way to fast and it help to playback slower in order to follow. Jumping between different screens quickly is also adding to the problem. But otherwise good material.

    • @ProgramWithGio
      @ProgramWithGio  10 หลายเดือนก่อน +1

      I appreciate the feedback, thank you

  • @benderbg
    @benderbg 4 หลายเดือนก่อน

    Last time I got tested this much was during pandemics. Another great in-depth lesson!

  • @hassan_codes
    @hassan_codes 2 ปีที่แล้ว +1

    The best PHP unit testing lessons out there. Thank you!
    You got a new subscriber.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Welcome aboard, thank you 💙

  • @michelversiani5019
    @michelversiani5019 3 วันที่ผ่านมา

    Thanks!

    • @ProgramWithGio
      @ProgramWithGio  3 วันที่ผ่านมา +1

      Thank you for your support 💙

  • @federicobau8651
    @federicobau8651 2 ปีที่แล้ว +3

    Great video, great content and good example for writing solid PHP tests.

  • @Vitalii-m6r
    @Vitalii-m6r ปีที่แล้ว

    Excellent! Thanks for this extremely useful PHP series!

  • @manto7
    @manto7 2 ปีที่แล้ว +1

    So smoooooooooooth ... Amazing content. Keep going Gio

  • @chooticharika
    @chooticharika 2 ปีที่แล้ว +1

    Gio your tutorials are amazing. Tiny request, is there away to rename them with numbers? I am struggling to find the videos when I need them immediately. Please try. Great work. I love them.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +2

      Thank you. Check the description of the video, there is a link to the outline repo which lists all the videos in order with their numbers, titles & links. Hope that helps

    • @chooticharika
      @chooticharika 2 ปีที่แล้ว

      @@ProgramWithGio ❤

  • @michelversiani5019
    @michelversiani5019 3 วันที่ผ่านมา

    Thank you so much, your videos helped me a lot!

  • @megamindsetsolutions
    @megamindsetsolutions 3 ปีที่แล้ว +1

    You're just so on point. Well done

  • @vuejs1
    @vuejs1 ปีที่แล้ว

    why do we use
    parent::setUp();
    in the setUp function?
    what the point? I thought we use it if our class extends other parent custom class?

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      In this specific example yes there is no need because its empty in the parent class. The parent::setUp() call was generated by IDE automatically when I overrode the method. That being said, it does not hurt to call the parent when overriding methods unless you specifically dont want to call it because in some cases it may contain crucial setup procedures needed for testing.

  • @sushiiguess7403
    @sushiiguess7403 2 ปีที่แล้ว +1

    Hi Gio, I'm trying to learn PHP from your guide and so far it's going great, thank you! I tried to include a stylesheet and it doesn't seem to work though. I found that some people fixed it by adding "include /etc/nginx/mime.types;" into the nginx.conf location part, but that doesn't solve it for me. Any idea how this could be fixed? Thank you again!

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Hey, how are you including the stylesheets? DM me on Twitter with screenshot & I'll help you troubleshoot it

  • @DanFletcher90
    @DanFletcher90 3 ปีที่แล้ว +1

    Awesome video! Very clear and to the point 👌

  • @Armando-px8hi
    @Armando-px8hi ปีที่แล้ว

    Gio I have some problems bro, so after downloading the phpunit in the vendor folder it creates only sebastian folder and nothing else. What can be the problem?

    • @Armando-px8hi
      @Armando-px8hi ปีที่แล้ว

      I just solved it GIO, in xampp I had the extension=zip in comments after uncommenting it, it helped. Thanks!

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +1

      Awesome, glad you got it working, good job

  • @dietrichmccray795
    @dietrichmccray795 2 ปีที่แล้ว +1

    Thank you for making this video!! I'm currently trying to do this and whenever I "extends TestCase", it gives me this error "Undefined type 'PHPUnit\Framework\TestCase'.". Are you able to tell me what it is wrong?

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      Have you set up autoloading properly in composer.json? DM me on Twitter and send me a screenshot of your composer.json and the test class and I can take a look.

  • @jordanbicanic9343
    @jordanbicanic9343 ปีที่แล้ว

    I noticed that you run compose to install phpunit directly in docker image. Is that necessary? I have composer installed globally

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Depends on your setup, in some cases you may not need it but I prefer to have it available in container

  • @g7k993
    @g7k993 2 ปีที่แล้ว +1

    What software do you suggest to improve my typing speed? Thank you for the video

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      I haven't used any software, just code & practice 🙂

  • @abdallakaram5376
    @abdallakaram5376 3 ปีที่แล้ว +1

    very impressive great Gio 💕❤️

  • @invgreat5608
    @invgreat5608 7 หลายเดือนก่อน

    Superb videos!! 💥

  • @md.omarfaruk2893
    @md.omarfaruk2893 2 หลายเดือนก่อน

    Great videos. Thank you

  • @mahmoudibrahim9803
    @mahmoudibrahim9803 2 ปีที่แล้ว +1

    You're awesome , thanks a lot for this amazing content :)

  • @nuvia1484
    @nuvia1484 3 ปีที่แล้ว

    Hello! I have a question. Our code is a mix of procedural and functional. Still, I want to have unit testing for my code. Is it possible to use PHPUnit for testing the functions? All of the examples given in the videos I watched are used for OOP and I don't know if I have to change something for PHPUnit to work.

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +1

      Hello! You could use PHPUnit to test procedural code. You may need some additional setup within the setup method but it's doable. Depending on what the function is or how complex it is, it might not be that hard to actually write tests for it. You could use include/requires if you are not using namespaces but I would recommend starting converting to OOP when possible.

    • @nuvia1484
      @nuvia1484 3 ปีที่แล้ว

      @@ProgramWithGio Thanks Gio! I really like to explore and practice OOP but we don't have much time to implement OOP and MVC to our project since we have little knowledge about it. Thanks again!

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +2

      @@nuvia1484 Makes sense. You're welcome

  • @RichardBlezer
    @RichardBlezer 7 หลายเดือนก่อน

    There is a deprecation waring for annotations /** @test */ . In the future (php unit 12) php attributes should be used. These look like this: #[test]

    • @aerohcss
      @aerohcss 2 หลายเดือนก่อน

      Attribute #[Test] doesn't work alone without test prefix like annotaions was able to do

  • @himanshujoshi8733
    @himanshujoshi8733 2 หลายเดือนก่อน

    amazing tutorial thank you bro

  • @pat1938
    @pat1938 3 ปีที่แล้ว

    Hey Gio, I've got a weird problem. After installing phpunit with composer and building the app I do get the PHPUnit folder with the files within the vendor directory, but there is an issue with vendor/bin. The explorer in VS Code doesn't see any phpunit files in there, and when I manually go there using the file explorer I see two empty files without extensions. They seem to be broken because I cannot even open them from there. Reinstalling phpunit with composer doesn't change anything. Do you reckon what could be the issue?

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว

      Hello 👋. That is strange, have you tried deleting vendors directory and running composer install after?

    • @DigitaSkills101
      @DigitaSkills101 2 ปีที่แล้ว

      Bro mine is same

    • @DigitaSkills101
      @DigitaSkills101 2 ปีที่แล้ว +1

      There is no extension but the file works and opens juat fine

  • @ClawHammer23
    @ClawHammer23 3 ปีที่แล้ว +1

    Great video, thanks

  • @truthteachers
    @truthteachers ปีที่แล้ว

    In my testing (timestamp 23:44), PHPUnit requires the "routeNotFoundCases" method to be static. Is it because i am using PHP 8.1.12?

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Did you add @dataProvider routeNotFoundCases to your test method? github.com/ggelashvili/learnphptherightway-project/blob/3.1/tests/Unit/RouterTest.php check this out and compare to your version

    • @truthteachers
      @truthteachers ปีที่แล้ว

      @@ProgramWithGio I checked out the code and mine are the same. This is the message i get "Data Provider method \Tests\DataProviders\RouterDataProvider::routeNotFoundCases() is not static"

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      @@truthteachers can you send me screenshot of your entire class? Can send it on Twitter DM

    • @aerohcss
      @aerohcss 2 หลายเดือนก่อน

      i got the same with phpdoc or data attribute #[DataProvider('routeNotFoundCases')]
      Just make it static I guess ;)

  • @issaissifou3579
    @issaissifou3579 2 ปีที่แล้ว +1

    Thank you so much!

  • @dawid_dahl
    @dawid_dahl 3 ปีที่แล้ว +1

    Thank you so much! 🙌🏻

  • @WhiteSiroi
    @WhiteSiroi 2 ปีที่แล้ว +1

    thank you very much

  • @NeverCodeAlone
    @NeverCodeAlone ปีที่แล้ว

    Very nice video...thx a lot.

  • @tamnguyentat5639
    @tamnguyentat5639 2 ปีที่แล้ว +1

    TY so much

  • @musilicks
    @musilicks ปีที่แล้ว +4

    For anyone that may face a hurdle with class dependencies not being picked up properly when you run phpunit, make sure you include the autoload object within your composer, which Gio talked about in this video: th-cam.com/video/rqzYdHdyMH0/w-d-xo.html. I had skipped that video and jumped straight into this one, and couldn't figure out why my classes weren't able to be found when running tests.

  • @rashmimore5844
    @rashmimore5844 6 หลายเดือนก่อน

    Thank you so much

  • @memack101
    @memack101 2 ปีที่แล้ว +1

    Thank you.

  • @Nepse_G
    @Nepse_G ปีที่แล้ว

    PHP Storm seems better. Which good IDE i can use for PHP for free?

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      I hear vscode is good, not a full fledged IDE but pretty good for free with plugins

  • @ricardormarcos
    @ricardormarcos 2 ปีที่แล้ว

    if i dont named test functions beginning with test, phpunit dont find it.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      You can add @test annotation to it and then it will work

    • @ricardormarcos
      @ricardormarcos 2 ปีที่แล้ว +1

      @@ProgramWithGio thanks, now it's working, I had capitalized the annotation first letter.

  • @AMoktar
    @AMoktar ปีที่แล้ว

    Awesome ❤

  • @louissardarescu6937
    @louissardarescu6937 3 ปีที่แล้ว

    what operating system you use?

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +1

      For recording windows, otherwise linux

    • @louissardarescu6937
      @louissardarescu6937 3 ปีที่แล้ว

      @@ProgramWithGio what linux distro is your favorite?

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +3

      I've been using Ubuntu

  • @aruppaul1468
    @aruppaul1468 3 ปีที่แล้ว +1

    great content

  • @tamnguyentat5639
    @tamnguyentat5639 2 ปีที่แล้ว

    Can i get this sourcecode ?

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Check description of the video

  • @AlirezaSalehi-xz3ch
    @AlirezaSalehi-xz3ch 2 ปีที่แล้ว

    thanks a lot

  • @omaryahia
    @omaryahia ปีที่แล้ว

    this is a little condensed for me 😐
    I need to break it down slowly
    multiple things are happening and new definitions are presented

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +1

      Yup, third section is more challenging for sure, so take your time

  • @ינוןאלבז-כ1ז
    @ינוןאלבז-כ1ז ปีที่แล้ว

    ❤❤❤❤

  • @carnaqe1154
    @carnaqe1154 ปีที่แล้ว

    i personally prefer TDD

  • @kunduz2652
    @kunduz2652 2 ปีที่แล้ว

    Let's see, make a site and see

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      umm, see what?

    • @kunduz2652
      @kunduz2652 2 ปีที่แล้ว

      @@ProgramWithGio blog site creation with php

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      @@kunduz2652 we are not building that in this series.

  • @tanjakahlo5255
    @tanjakahlo5255 3 ปีที่แล้ว

    Really great content! But in my opinion, very difficult to listen to. The whole video series follows a melancholy tone of reading the text, without a dot or comma, as if everything was read in one breath, which makes it difficult for me as a listener to follow your video tutorials. If you use audio editing programs where you eject parts without voice, to reduce the length of the recording, then you get a robotic audio recording. Maybe my English is not that good, but that is my honest opinion and constructive suggestion to change for the next tutorials.

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +2

      Thank you for feedback. English isn't my native language so that combined with me speaking fast can be a factor. Also yes I've done wrong audio editing on some videos so that is something I'm gonna get better at 👍. That being said though I don't think "entire series" are like that, just few videos in my opinion. Changing playback speed on TH-cam might help a little bit.

    • @tanjakahlo5255
      @tanjakahlo5255 3 ปีที่แล้ว +1

      @@ProgramWithGio Thank you so much!!! 👍

  • @ballpen9157
    @ballpen9157 4 หลายเดือนก่อน

    I'm having a hard time understanding this :(

    • @ProgramWithGio
      @ProgramWithGio  4 หลายเดือนก่อน

      Try rewatching it or if there is something specific you are not understanding dig into the documentation

    • @ballpen9157
      @ballpen9157 4 หลายเดือนก่อน

      @@ProgramWithGio thank you. Your reply helps a lot.

  • @truthteachers
    @truthteachers ปีที่แล้ว

    Bro, for vscode in Windows 10, the command line for initiating phpunit is "php phpunit --version".

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Depends how its installed, maybe on your side its installed globally & the executable is part of the system's PATH variable. Or maybe its just an alias to `vendor/bin/phpunit`.

    • @truthteachers
      @truthteachers ปีที่แล้ว

      @@ProgramWithGio Its ok. We have lots of problems with TH-cam courses. Most trainers use either the Mac or Linux server and we use XAMPP on windows which works well with VPS servers running CPanel. We try and figure it out or give up on the course and move on. Hehehe..

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +1

      @@truthteachers XAMPP shouldn't be used in production to be honest. And the OS shouldn't really matter, you can use WSL in Windows and have Linux subsystem. I'm not sure I understand what the issue is with TH-cam courses or this specific course. I use Windows in the series with WSL but we use Docker instead of XAMPP, XAMPP we used in 1st section

  • @marlonlima3370
    @marlonlima3370 3 ปีที่แล้ว +1

    great video