Getting Started with PHP Unit Testing Course

Go to class
Write Review

Free Online Course: Getting Started with PHP Unit Testing Course provided by Treehouse is a comprehensive online course, which lasts for 1-2 hours worth of material. The course is taught in English and is free of charge.

Overview
  • For all us imperfect programmers, I have some great news. There are tools that can help you keep those mistakes from breaking your application. They can also help you find and fix bugs faster, while at the same time, preventing those bugs from ever coming back. Many of these tools revolve around testing.

    What you'll learn

    • Unit Testing
    • PHPUnit
    • Test Driven Development
    • Code Coverage
    • Test Doubles

Syllabus
  • Introduction to Unit Testing

    Is the foundation of our testing would. Unit tests are written to verify that individual modules, these small units of code, are functioning the way that you expect. They do NOT talk to outside components such as a database or API. If you're familiar with Interfaces, it's kind of the same idea. If we pass the correct information, we should get back the expected results.

    Chevron 6 steps
    • The World of Testing

      3:29

    • Writing Your First Tests

      4:56

    • First Test

      6 questions

    • Running the Example

      6:26

    • Configuration

      5:17

    • Example Configuration

      5 questions

    Test Driven Development

    When you start learning about testing, you very quickly start hearing about a practice known as Test-Driven Development, or TDD. It's the practice of: write a test for a small module (or unit) of code as if it worked already. Write the code until the tests pass. Repeat until you have tests for every unit of code you have written.

    Chevron 9 steps
    • Developing with TDD

      6:43

    • Writing for the Test

      1:12

    • Start with Tests

      3 objectives

    • Consonant Clusters

      2:44

    • Keeping Bugs at Bay

      2:22

    • Test Driven Development

      5 questions

    • Refactor

      2:18

    • Test for the Final Rule

      1:44

    • Refactoring with Tests

      5 questions

    Testing Existing Projects

    We don't always have the option to build things perfectly the first time, and we're always learning, so that perfect way is going to change. A great thing about PHPUnit is its wide adoption. Almost every framework comes shipped with PHPUnit or allows for easy integration. You can also add PHPUnit as a separate package for any object-oriented application.

    Chevron 9 steps
    • Adding PHPUnit

      5:36

    • Code Coverage

      2:52

    • Project Coverage

      5 questions

    • Fixtures

      5:48

    • Setup Fixure

      1 objective

    • Testing Exceptions

      2:39

    • Getting to 100%

      1:46

    • Testing Goals

      1:20

    • Expecting 100%

      5 questions