تست

کاتا کدنویسی با 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.

سطح متوسط 10 جلسه آموزشی 02:34:00 ساعت
01
قسمت 1

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.

02
قسمت 2

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.

03
قسمت 3

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.

04
قسمت 4

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".

05
قسمت 5

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.

06
قسمت 6

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.

07
قسمت 7

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.

08
قسمت 8

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.

09
قسمت 9

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.

10
قسمت 10

99 Bottles

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.