Back Button Testing
Code Katas with PHPUnit

Code Katas with PHPUnit

If martial artists use kata as a method for exercise and practice, what might be the equivalent for coders like us? Coding katas are short, repeatable programming challenges which are meant to exercise everything from your focus, to your workflow.

In this series, one kata per episode, we'll work through a wide variety of challenges to build up your TDD process.

Intermediate
10 episodes
2h 58m
10
Latest Episode in This Series

Added 3 weeks ago

99 Bottles Kata

Next up, we'll tackle the 99 Bottles Kata. Our job is to construct the entire...

Watch
Code Katas with PHPUnit

Code Katas with PHPUnit

If martial artists use kata as a method for exercise and practice, what might be the equivalent for coders like us? Coding katas are short, repeatable programming challenges which are meant to exercise everything from your focus, to your workflow.

In this series, one kata per episode, we'll work through a wide variety of challenges to build up your TDD process.

Begin
10
Latest Episode in This Series

Added 3 weeks ago

99 Bottles Kata

Next up, we'll tackle the 99 Bottles Kata. Our job is to construct the entire "99 Bottles...
Watch

Your Teacher | Jeffrey Way

https://laracasts.s3.amazonaws.com/avatars/jeffrey-avatar.jpg's avatar
Hi, I'm Jeffrey. I'm the creator of Laracasts and spend most of my days building the site and thinking of new ways to teach confusing concepts. I live in Orlando, Florida with my wife and two kids.
    1. EPISODE 1

      Run Time 1:31

      Free

      Kata is a martial arts term from Japan that refers to a choreographed sequence of movements. The goal is to perfect and internalize these movements through repetition and memorization. Once mastered, these sequences serve as a reference guide that you can instantly reach for and adapt without thought.

      Outside of martial arts, this word, kata, is used more generally to refer to any set of steps or patterns that is repeated until mastery. Think of it as a way to harness your form and routine.

    2. EPISODE 2

      Run Time 51

      Free

      Before we attempt our first coding kata, let's first take a moment to setup a base directory for our exercises. We'll use Composer to pull in PHPUnit and then register PSR-4 autoloading for the project.

    3. EPISODE 3

      Run Time 14:55

      Free

      First up is the prime factors Kata. A prime number is a number that is only divisible by itself and one (2, 3, 5, 7, 11...). Further, for any given number, we can generate its prime factors by reducing it down to exclusively prime numbers that, when multiplied, equal the number in question. In this lesson, we'll use TDD to create a class that can generate all prime factors for a number.

      View the source code for this episode on GitHub.

    4. EPISODE 4

      Run Time 16:47

      Next up is the popular Roman numerals challenge. Our job is to create a class using TDD that can generate the corresponding Roman numeral for a provided number. To provide a few examples, 1 should return "I", 6 should return "VI", and 10 should return "X".

      View the source code for this episode on GitHub.

    5. EPISODE 5

      Run Time 23:40

      I bet you didn't expect to learn the rules of Bowling on Laracasts, but here we are. In this lesson, we'll use TDD to record and score a completed bowling game.

      View the source code for this episode on GitHub.

    6. EPISODE 6

      Run Time 25:03

      Next up is the string calculator kata. Our job is to create a class with a single public method that accepts a string of numbers to add. However, as part of the kata, a number of requirements must first be met, such as disallowing negative numbers and ignoring numbers greater than 1,000. Let's get started.

      View the source code for this episode on GitHub.

    7. EPISODE 7

      Run Time 36:50

      Now that you've learned how to score a bowling game, let's move on to a Tennis match. This one is a bit more complicated, but well worth the effort.

      Once you've completed the video, take a look at the source code to see how I solved the small homework challenge at the end of the video on GitHub.

    8. EPISODE 8

      Run Time 8:35

      Next up is the obligatory FizzBuzz kata, which I think you'll find is quite a bit easier than previous exercises. This is especially true, now that we've built up our TDD chops.

      View the source code for this episode on GitHub.

    9. EPISODE 9

      Run Time 27:57

      I'll warn you. This kata will be the most difficult of the entire series. However, it'll also be the most rewarding. By slowly refactoring an existing piece of code, we'll learn about seams, polymorphism, "making the change easy," and so much more.

      If working along, begin by cloning this GitHub repository. Then press play! Otherwise, the completed source code may be reviewed here.

    10. EPISODE 10

      Run Time 23:41

      Next up, we'll tackle the 99 Bottles Kata. Our job is to construct the entire "99 Bottles of Beer on the Wall" song using TDD.

      View the source code for this episode on GitHub.