PHP Unit Testing with PHPUnit: Find Bugs and Improve Code Quality – Udemy

(10 customer reviews)


Categories: , Tag:


What you’ll learn

  • Write automated tests for your functions and classes
  • Write better code with less bugs, in less time
  • Develop code using test-driven development
  • Know that the code you write works how you want it to
  • Have improved documentation for your code
  • Get support directly from the instructor

If you are a PHP developer and you want to learn how to write better code, with fewer bugs, you will need to know how to write unit tests.

Learn how to unit test your PHP code using the PHPUnit testing framework.

  • Learn what unit tests are

  • Learn how to write unit tests using PHPUnit

  • Build a test suite for PHP functions and classes

  • Make test methods dependent on each other

  • Use test doubles: mocks and stubs, including how to use Mockery

  • Learn how and why you should use dependency injection

  • Learn test-driven development (TDD)

  • Learn how to test protected and private methods and properties (and whether you actually should or not!)

  • Learn how to test abstract classes

A skill that will enable you to write higher quality code, in a shorter time, with better documentation and fewer bugs.

Learning how to write unit tests for your code will make you write better code. With automated tests, you can find bugs more easily, and if you break something you’ll notice straight away.

Many experienced developers write unit tests for their code. It’s a repeatable way of checking that the code works as intended, and also serves as documentation. Many popular PHP projects are unit tested, such as WordPress and Moodle, and if you use frameworks such as Laravel or Symfony, these provide tight integration with the PHPUnit testing framework.

Content and Overview

How do you currently test your code? Maybe you run your code in a browser, use var_dump a lot and so on. The problem with this is that you only tend to test new code – you don’t go back and test old code. What if you add some new code that breaks the old code?

With automated unit tests, you have more control. If your new code breaks something, you’ll notice straight away. You can fix bugs more easily, thereby reducing development time.

Tests are also a form of documentation, just like comments: they serve to show why the code has been written that way.

  • Suitable for all PHP developers, you’ll start by learning the basics of unit testing PHP code, including how to use assertions.

  • Then you’ll learn how to test functions and classes, and how to configure the PHPUnit framework.

  • Next you’ll learn how to use test dependencies, fixtures and how to test for exceptions.

  • You’ll also see how test doubles work – mock objects and stub methods.

  • Then you’ll learn how to write code using test-driven development – writing the tests first, then the code.

  • You’ll also learn how to test protected and private class methods and properties, and whether this is actually a good idea or not.

  • Testing static methods is covered in detail, including several methods for dealing with static dependencies.

When you complete the course you’ll be able to write unit tests for your existing PHP code, and develop new code using test-driven development.

Complete with all the code shown in the lectures, you’ll be able to work alongside the instructor and will receive a verifiable certificate of completion upon finishing the course.

Also, at all times throughout the course you have access to the instructor in the Q&A section to ask for help with any topic related to the course.

Enrol now and add unit testing to your PHP skillset!

Who this course is for:

  • PHP developers who want to improve the quality of their code by writing automated tests for their functions and classes
  • PHP developers who want to learn the PHPUnit testing framework
  • This course is about unit testing – this course is probably not for you if you’re looking to learn how to test the user interface

Course content

  • Introduction and project setup
  • Unit testing with PHPUnit: the basics
  • Configuring the PHPUnit test environment
  • Test dependencies, fixtures and exceptions
  • Test doubles: mocks and stubs
  • Mockery – an alternative mocking framework with a human-readable syntax
  • Test-driven development
  • Testing non-public methods and properties and abstract classes
  • Testing static methods
  • Conclusion

10 reviews for PHP Unit Testing with PHPUnit: Find Bugs and Improve Code Quality – Udemy

  1. Donny Phan

    Super practical. Lessons are catered towards anyone looking to find work in this industry. It felt very comprehensive and gave me a broad understanding of the programming spectrum

  2. Madhav raj Verma

    Thanks for your great effort. i am fully satisfied with this course the way you teach and your explanation are very clear ,The content you provide in your course no one can do this at this price.

  3. Sachin Gupta

    I really didn’t want to leave a low rating as Angela is a great teacher. The 1st half of this course was terrific. The 2nd half was terrible. Under the justification of “teaching students how to figure things out on their own”, pretty much all videos and all explanations were dropped. You were just told what to do, given links to documentation and told to figure it out on your own. I understand doing that to some degree, but to revert to that entirely for nearly half the content barely makes this a course. It’s just a list of things for you to learn, then you’re left on your own to learn them. The 2nd half was so bad, especially the data science component, that I didn’t bother finishing the course.

  4. Vincent Beaudet

    Amazing 40 days course.
    Angela is a great teacher.
    The other 60 days are all about web developement, interacting with web pages, on your own with little to no explanations. I did not expect that at all. I wanted to learn more about software and scripting.
    This left me disappointed , confused and i started to doubt myself. Not a fun experience after the amount of effort i’v put in this course.

    Exercices format and explanations for the first 40 days were worth it tho.

  5. Ben K

    Not just an introduction to python, but really helps you learn fundamental aspects of python and coding in general. Some parts may require some knowledge on the subject (data science comes to mind) and there is quite some web development in the course. So, a few areas were not completely to my liking (I would have liked to see it done differently), but this course deserves the 5 stars in my opinion.

  6. Omid Alikhel

    I found the method a bit difficult when a code is written and then changed back to something different, with no enough explanation of how something happened and where it came from or a step by step explanation of why something is happening, i have no doubt in the instructors talent, but we are beginners!

  7. Devang Jain

    The course is not updated and most of the solution codes don’t work and there are no video solutions towards the end

  8. Szymon Kozak

    I think that the course tutor is really good in giving right information to learn at the right time. Thanks to this fact, my understanding of coding in python after 29 days of learning is above my expectations.

  9. Begoña Ruiz Diaz

    Ha sido la mejor elección que podría haber hecho.

  10. Vaibhav Sachdeva

    I want to thank Angela for making such an amazing course. It really helped me explore more things with python.

Add a review

Your email address will not be published.