PHP Unit Testing - PHPUnit Tutorial - Full PHP 8 Tutorial

Поделиться
HTML-код
  • Опубликовано: 29 янв 2025

Комментарии • 141

  • @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 2 года назад +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

  • @chrisodillman3355
    @chrisodillman3355 Год назад +5

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

  • @sadhakbj
    @sadhakbj 3 года назад +21

    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 🙏

  • @ilyaslabukarov5959
    @ilyaslabukarov5959 2 года назад +7

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

  • @RandallNewman
    @RandallNewman Год назад

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

  • @ahmedamshir3925
    @ahmedamshir3925 3 года назад +5

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

  • @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 🙏

  • @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.

  • @benderbg
    @benderbg 5 месяцев назад

    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.

  • @danabooysen4672
    @danabooysen4672 11 месяцев назад

    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  11 месяцев назад +1

      I appreciate the feedback, thank you

  • @DigitaSkills101
    @DigitaSkills101 2 года назад +1

    Your tutorials are proofs why php is most used language

  • @federicobau8651
    @federicobau8651 3 года назад +3

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

  • @michelversiani5019
    @michelversiani5019 Месяц назад

    Thanks!

  • @manto7
    @manto7 3 года назад +1

    So smoooooooooooth ... Amazing content. Keep going Gio

  • @Vitalii-m6r
    @Vitalii-m6r Год назад

    Excellent! Thanks for this extremely useful PHP series!

  • @megamindsetsolutions
    @megamindsetsolutions 3 года назад +1

    You're just so on point. Well done

  • @michelversiani5019
    @michelversiani5019 Месяц назад

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

  • @DanFletcher90
    @DanFletcher90 3 года назад +1

    Awesome video! Very clear and to the point 👌

  • @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 ❤

  • @abdallakaram5376
    @abdallakaram5376 3 года назад +1

    very impressive great Gio 💕❤️

  • @RichardBlezer
    @RichardBlezer 8 месяцев назад

    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 3 месяца назад

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

  • @invgreat5608
    @invgreat5608 8 месяцев назад

    Superb videos!! 💥

  • @mahmoudibrahim9803
    @mahmoudibrahim9803 2 года назад +1

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

  • @himanshujoshi8733
    @himanshujoshi8733 3 месяца назад

    amazing tutorial thank you bro

  • @md.omarfaruk2893
    @md.omarfaruk2893 3 месяца назад

    Great videos. Thank you

  • @WhiteSiroi
    @WhiteSiroi 2 года назад +1

    thank you very much

  • @dawid_dahl
    @dawid_dahl 3 года назад +1

    Thank you so much! 🙌🏻

  • @issaissifou3579
    @issaissifou3579 2 года назад +1

    Thank you so much!

  • @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

  • @tamnguyentat5639
    @tamnguyentat5639 2 года назад +1

    TY so much

  • @ClawHammer23
    @ClawHammer23 3 года назад +1

    Great video, thanks

  • @AMoktar
    @AMoktar Год назад

    Awesome ❤

  • @NeverCodeAlone
    @NeverCodeAlone Год назад

    Very nice video...thx a lot.

  • @rashmimore5844
    @rashmimore5844 7 месяцев назад

    Thank you so much

  • @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 🙂

  • @memack101
    @memack101 2 года назад +1

    Thank you.

  • @aruppaul1468
    @aruppaul1468 3 года назад +1

    great content

  • @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.

  • @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: ruclips.net/video/rqzYdHdyMH0/видео.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.

  • @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.

  • @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

  • @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

  • @AlirezaSalehi-xz3ch
    @AlirezaSalehi-xz3ch 2 года назад

    thanks a lot

  • @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

  • @ינוןאלבז-כ1ז
    @ינוןאלבז-כ1ז Год назад

    ❤❤❤❤

  • @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

  • @louissardarescu6937
    @louissardarescu6937 3 года назад

    what operating system you use?

  • @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

  • @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.

  • @tamnguyentat5639
    @tamnguyentat5639 2 года назад

    Can i get this sourcecode ?

  • @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.

  • @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

  • @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 RUclips might help a little bit.

    • @tanjakahlo5255
      @tanjakahlo5255 3 года назад +1

      @@ProgramWithGio Thank you so much!!! 👍

  • @ballpen9157
    @ballpen9157 6 месяцев назад

    I'm having a hard time understanding this :(

    • @ProgramWithGio
      @ProgramWithGio  6 месяцев назад

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

    • @ballpen9157
      @ballpen9157 6 месяцев назад

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

  • @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 3 месяца назад

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

  • @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 RUclips 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 RUclips 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