Learning Lab Home/Software Engineering/PHP Unit Testing with PHPUnit

PHP Unit Testing with PHPUnit

Course From:
Udemy

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 dependenciesfixtures 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.

 

Course
Intermediate
Careers

Careers Related to PHP Unit Testing with PHPUnit

Jobs

Jobs Related to PHP Unit Testing with PHPUnit

Certifications

Certifications related to PHP or Software Quality Assurance

General Assembly’s Software Engineering Immersive is a transformative course designed for you to get the necessary skills for a coding role in three months. 

The Software Engineering bootcamp is led by instructors who are expert practitioners in their field, supported by career coaches that work with you since day one and enhanced by a career services team that is constantly in talks with employers about their tech hiring needs.

 

What you'll accomplish

As a graduate, you’ll have a portfolio of projects that show your knowledge of fundamental programming concepts, as well as experience with languages, frameworks, and libraries that employers demand. Throughout this expert-designed program, you’ll:

  • Create a front-end web application with modern JavaScript frameworks such as Angular or React.

  • Develop and deploy full-stack applications with in-demand technologies such as Ruby on Rails, Python with Django, and Express with Node.js.

  • Build secure full-stack applications by leveraging common design and architectural patterns like model–view–controller (MVC) and Representational State Transfer (REST).

  • Practice version control and collaborative software development with Git and GitHub.

  • Safely model and store data in SQL and NoSQL databases.

  • Consume and integrate third-party application programming interfaces (APIs) in an application.

 

Why General Assembly

Since 2011, General Assembly has graduated more than 40,000 students worldwide from the full time & part time courses. During the 2020 hiring shutdown, GA's students, instructors, and career coaches never lost focus, and the KPMG-validated numbers in their Outcomes report reflect it. *For students who graduated in 2020 — the peak of the pandemic — 74.4% of those who participated in GA's full-time Career Services program landed jobs within six months of graduation.  General Assembly is proud of their grads + teams' relentless dedication and to see those numbers rising. Download the report here.

 

Your next step? Submit an application to talk to the General Assembly Admissions team

 

 

Note: reviews are referenced from Career Karma - https://careerkarma.com/schools/general-assembly

General Assembly
Courses

Courses related to PHP or Software Quality Assurance

Udemy

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.

Udemy

Laravel has become one of the most popular if not the most popular PHP framework. Employers are asking for this skill for all web programming jobs and in this course we have put together all of them, to give you the best chance of…

Udemy

Are you new to PHP or need a refresher? Then this course will help you get all the fundamentals of Procedural PHP, Object Oriented PHP, MYSQLi, and ending the course by building a CMS system similar to WordPress, Joomla, or…

Udemy

In this course we will go step by step to build a complete custom MVC (Model View Controller) framework Called TraversyMVC using object oriented PHP. We will build something similar to Codeigniter but much much…