Git Product home page Git Product logo

tdd-workshop-php's Introduction

Test Driven Developement Workshop (PHP)

This is the PHP code base to use when attending my introduction to TDD workshop

Tasks

Demo 1 (Stack - Abstract Data Type)

As a group we will implement a String Stack (First In, Last Out - FILO) that will conform to the Collection Interface.

Task 1 (Queue - Abstract Data Type)

In pairs you will implement a String Queue (First In, First Out - FIFO) that will conform to the Collection Interface.

Demo 2 (Lunchtime Meal Deal - Simple Application)

As a group we will implement a Simple Application that conforms to the Till Interface to calculate the total cost of a basket based on the lunch time meal deal

  • Sandwich £2.00
  • Drink £0.90
  • Crisps £0.50
  • Sandwich, Drink & Crisp £3.00

Task 2 (BOGOF & BTGTHP - Simple Application)

In pairs you will continue to implement the Till Interface to calculate the total cost of a basket based on Baked Beans and Spaghetti Hoop offers

  • Baked Beans £0.75

  • Spaghetti Hoops £0.80

  • Baked Beans Offer: Buy One Get One Free (BOGOF)

    • 2 * Baked Beans = £0.75
    • 3 * Baked Beans = £1.50
  • Spaghetti Hoop Offer: Buy Two Get Third Half Price (BTGTHP)

    • 2 * Spaghetti Hoops = £1.60
    • 3 * Spaghetti Hoops = £2.00
    • 4 * Spaghetti Hoops = £2.80

Demo 3 (Ledger - Dependencies: London Style)

As a group we will implement the Ledger Interface using the London / Interaction style of testing

Demo 4 (Ledger - Dependencies: Chicago Style)

As a group we will implement the Ledger Interface using the Chicago / State style of testing

Task 3 (FileLogger - Dependencies: London Style)

In Pairs you need to implement Logger Interface that uses an SplFileObject using the London / Interaction style of testing

Note: When creating the mock of SplFileObject the mock requires you give the first constructor argument.

See Example:

    $file = \Mockery::mock(\SplFileObject::class, ['/dev/null']);

Task 4 (FileLogger - Dependencies: Chicago Style)

In Pairs you need to implement Logger Interface that uses an SplFileObject using the Chicago / State style of testing

Note: the exec may be helpful for setup and assertions

Demo 5 (Integer - Mutation Testing)

Demonstrating how Infection a PHP mutation testing library can be used ensure tests full

Demo 6 (Date Range - Changing the requirements)

Demonstrating how to change the tests when the requirements change.

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.