Giter Site home page Giter Site logo

miguel-serrano / php-kata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carlosbuenosvinos/php-kata

0.0 2.0 0.0 202 KB

PHP skeleton for doing coding katas (PHPUnit, mockery, phpspec and prophecy)

Home Page: https://github.com/carlosbuenosvinos/php-kata

PHP 100.00%

php-kata's Introduction

kata/php

PHP skeleton for doing coding katas

Code Kata is a term coined by Dave Thomas, co-author of the book The Pragmatic Programmer, in a bow to the Japanese concept of kata in the martial arts. A code kata is an exercise in programming which helps a programmer hone their skills through practice and repetition. As of October 2011, Dave Thomas has published 21 different katas.

You can find some to start practicing here.

When you do programming katas, you use TDD. That's why I have included PHPUnit, Mockery, PHPSpec and Prophecy as composer dependencies. Choose the testing framework you feel more comfortable (or play with both).

Practicing a kata

Let's imagine you want to practice "Bowling game kata". Details about this kata can be found here.

You will need composer.

curl -sS https://getcomposer.org/installer | php

Then, use "create-project" command to clone this project as a template and create a new one in your computer.

php composer.phar create-project kata/php bowling-kata dev-master

Then add your classes to 'src/Kata' and your test cases to 'src/Kata/Tests' and run 'php bin/phpunit' to run your tests.

php bin/phpunit

TestCase examples

If you run 'php bin/phpunit' you will see the following output.

PHPUnit 3.8-gc4f2bcd by Sebastian Bergmann.

Configuration read from /Users/carlosbuenosvinos/Documents/Web/bowling/phpunit.xml

...

Time: 91 ms, Memory: 1.75Mb
OK (3 tests, 3 assertions)

That's because you will find one class and its TestCase in the project in order to help you. You can delete them.

Adder is a class that adds two numbers and AdderTest tests that.

php-kata's People

Contributors

carlosbuenosvinos avatar quimcalpe avatar

Watchers

James Cloos avatar Dcb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.