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

SymfonyCasts

PHPUnit (Legacy): Testing with a Bite

via SymfonyCasts

Overview

It's Friday night... it's stormy... the office is empty... and you're deploying fresh code to production. Suddenly, an alarm! What!? The fences are down!? The dinosaurs are escaping! Somehow, your beautiful code contained a bug! And as the raptors surround you, one thought keeps coming back: if only we had written tests.

Indeed.

In this tutorial, we're going to jump over the hurdle of learning how to test so you can save the day!

  • Basic unit testing
  • Test-Driven-Development: how to do it, when to do it!
  • Mocking and test doubles! Creating mocks in PHPUnit & Prophecy
  • Using data providers to run tests over and over again with different input
  • Running code before and after each test
  • Testing for exceptions
  • Handling the database in tests
  • Integration tests: testing with real objects
  • Functional testing!
  • Continuous Integration (CI): let the robots run your tests

So grab your keyboard, reboot the system, and start testing with us!

Syllabus

  • PHPUnit: Secure the Park
  • Tests, Assertions & Coding
  • TDD & Unit, Integration & Functional Tests
  • TDD in Practice
  • Factory Testing
  • Hooks: setUp, tearDown & Skipping Tests
  • Data Providers!
  • Coding, Adding Features, Refactoring
  • Handling Object Dependencies
  • Testing Exceptions
  • Exceptions Part 2: Adding Fence Security
  • Refactoring & Dependency Injection
  • Mocks & Test Doubles
  • Mocks: Control the Return Value
  • Mocks: expects() Assert Method is Called Correctly
  • Full Mock Example
  • Full Mock Example: the Sequel
  • Mocking with Prophecy
  • The Important CLI Options & phpunit.xml.dist
  • Integration Tests
  • Clearing the Database
  • Partial Mocking
  • Functional Tests
  • DomCrawler: Epic Beast of the Night
  • Test Fixtures & Fast Databases!
  • Loading Fixtures References
  • Testing a Form Submit
  • Continuous Integration: Activate the Robots
  • CircleCI Artifacts

Taught by

Andrew Marcinkevičius, Ryan Weaver, and Leanna Pelham

Reviews

Start your review of PHPUnit (Legacy): 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.