Laracasts - Code Katas with PHPUnit
This post was published 5 years ago. Download links are most likely obsolete. If that's the case, try asking the uploader to re-upload.

Genre: eLearning | MP4 | Video: AVC, 1280x720 | Audio: aac, 48 kHz
Language: English | Size: 612 MB | Duration: 10 episodes (2h58m) | Intermediate
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.
Programming Katas Explained
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.
60-Second PHPUnit Setup
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.
Prime Factors Kata
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.
https://gist.github.com/JeffreyWay/e66f646c7cdc606fb51fca93cd6bf02c
Roman Numerals Kata
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.
https://gist.github.com/laracasts/a3c375b8b977fc71b2dcd200f49a7776
Bowling Game Kata
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.
https://gist.github.com/laracasts/70d59758574c6828e743e23fe9eb15f0
String Calculator Kata
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.
https://gist.github.com/laracasts/869863f60ae3554a1c740e7eb787e745
Tennis Match Kata
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.
https://gist.github.com/laracasts/6ddc75cdf6e2749da6a1eccc554e9dc3
FizzBuzz Kata
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.
https://gist.github.com/JeffreyWay/4060514308c0a845af2b99fc2618204e
The Gilded Rose Kata
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.
GitHub
https://github.com/laracasts/gilded-rose-with-phpunit
reviewed
https://github.com/laracasts/gilded-rose-with-phpunit/tree/completed
99 Bottles Kata
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.
https://gist.github.com/JeffreyWay/3b7adae64ebabf1f6df679ebddba1929
Screenshots
Quick check before we show the links
Helps us keep automated scrapers from hammering the filehosts.
