2017 © Pedro Peláez
 

library testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

image

tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  • Sunday, January 22, 2017
  • by tfrommen
  • Repository
  • 1 Watchers
  • 8 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 13 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

How (Not) to Write Testable Code

This repository contains example code for the according talk at WordCamp Nuremberg, 2016., (*1)

Unit Test Examples

The first part of the talk is about unit testing. After a short summary, you can see several unit test examples. This repository includes the complete and fully documented versions of the presented PHP unit tests as well as the respective JavaScript unit tests., (*2)

Running the Tests

You want to run the tests yourself? Here's how:, (*3)

JavaScript

In order to run the JavaScript tests, you have to install the required npm packages first., (*4)

Using Yarn:, (*5)

$ yarn && yarn run test

Using npm:, (*6)

$ npm i && npm run test

PHP

In order to run the PHP tests, you have to install the required Composer packages first., (*7)

$ composer install && vendor/bin/phpunit

Bad Practices

The second and main part of the talk then is about code examples that are either hard to test, or not testable at all. As with the unit test examples, this repository also includes the bad practice PHP code and JavaScript code examples., (*8)

Since only presenting _bad_ (i.e., hard-to-test) code doesn't do any good, this repository also includes improved versions of the code. For each of the code examples, you can find an according pull request. By means of the diff view, you can easily compare the original and the improved code., (*9)

Feel free to fork this repository, and work on possible tests, if you like., (*10)

Changelog

Changelog., (*11)

License

Copyright (c) 2016 Thorsten Frommen, (*12)

This code is licensed under the MIT License., (*13)

The Versions

22/01 2017

dev-master

9999999-dev https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code unit testable es6 sinon tape

26/03 2016

dev-php/insane-complexity

dev-php/insane-complexity https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-js/eval-expressions

dev-js/eval-expressions https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-php/creating-intermediary-objects

dev-php/creating-intermediary-objects https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-js/incomplete-initialization

dev-js/incomplete-initialization https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-php/calling-static-methods

dev-php/calling-static-methods https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-js/breaking-the-law-of-demeter

dev-js/breaking-the-law-of-demeter https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-php/using-unresettable-singletons

dev-php/using-unresettable-singletons https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-js/global-state

dev-js/global-state https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-php/creating-real-objects-2

dev-php/creating-real-objects-2 https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-php/creating-real-objects

dev-php/creating-real-objects https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-js/leaving-the-context

dev-js/leaving-the-context https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-php/terminating-the-execution

dev-php/terminating-the-execution https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape

26/03 2016

dev-js/no-feedback

dev-js/no-feedback https://github.com/tfrommen/testable-code

Example code for the talk "How (Not) to Write Testable Code" at WordCamp Nuremberg, 2016.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

mockery phpunit testing php javascript code testable sinon tape