Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

SymfonyCasts

PHPUnit: Unit Testing with a Bite!

via SymfonyCasts

Overview

Wait, someone built ANOTHER dinosaur park with ZERO tests!?!? I've seen this movie before and it's up to us: to add a rich set of tests before the dinos come for us...

But seriously: testing is great. It's not only a tool for preventing bugs, it's also a development philosophy that can help you write code that's more focused on what you actually want to build.

In this tutorial, we'll get you to super-hero status of unit testing, including:

  • Basic unit testing
  • Test-Driven-Development: how to do it, when to do it!
  • Using data providers to run tests over and over again with different input
  • Mocking and test doubles! Creating mocks in PHPUnit
  • The PHPUnit executable and configuration
  • Testing for exceptions

What about "integration" and "functional" testing? Stay tuned for the next tutorials in this series!

Syllabus

  • PHPUnit Install
  • Our First Test
  • Testing Class Methods
  • TDD - Test Driven Development
  • TDD Part 2: Finish & Refactor
  • Data Providers
  • Incomplete Tests and Dancing Dino's
  • Create a GitHub Service Test
  • GitHub Service: Implementation
  • Mocking: Test Doubles
  • Mocking: Stubs
  • Mocking: Mock Objects
  • Filtering Out Hungry Dino's
  • Testing Exceptional Exceptions
  • Mocking Symfony's Http Client
  • Setup and Tearing It Down

Taught by

Jesse Rushlow and Ryan Weaver

Reviews

Start your review of PHPUnit: Unit Testing with a Bite!

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.