News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Michelangelo van Dam's Blog:
Quality Assurance on PHP projects - PHPUnit part 3
August 29, 2011 @ 09:18:28

Michelangelo van Dam is back today with the next part of his "Quality Assurance in PHP Projects" series, the third part of his look at PHPUnit, the popular PHP-based unit testing software.

Time for the third part on unit testing with phpunit in my Quality Assurance on PHP projects series. In part one we started writing unit tests for a simple game of tic-tac-toe. In part two we started converting our unit tests into actual code and moved our general unit test code for grids into a Grid focussed unit test. In this part, we're looking at how we can optimize the tests for our players.

He digs deeper into the TicTacToe application and focuses first on the single-player functionality, checking the symbol for the current player (an "X" or "O") and throwing exceptions in the code when things aren't right. He also shows the tests for checking on "more than one player" and "cannot add more than two players" scenarios. Full code for the Player class and tests are included.

1 comment voice your opinion now!
quality assurance project phpunit unittest tutorial tictactoe tdd


Michelangelo van Dam's Blog:
Quality Assurance on PHP projects - PHPUnit part 2
August 23, 2011 @ 08:38:19

Michelangelo van Dam has posted the second part of his look at PHPUnit in his "Quality Assurance in PHP Projects" blog post series. This is a continuation from part one.

I hope everyone enjoyed my first article on unit testing with phpunit where I started writing a few tests that would guide us building our little game of tictactoe. Today I'm going start with turning these tests into working code and adjusting our tests to have a clear separation of responsibility. Since we already know what the code should produce, we only have to work out the details.

He picks up where he left off on his "tic-tac-toe" example by defining some of the classes that will be needed to fulfill the tests and a sample test to check the generated grid's contents. He includes the Grid class that will do the job (full code included) and a full test case class that runs his example with checks on testGameGridIsSetAtStart, testGridCanPositionASymbol, testGridHasThreeSymbolsInARow and testGridHasThreeSymbolsInAColumn, some with their own data providers.

0 comments voice your opinion now!
quality assurance project phpunit unittest tutorial tictactoe tdd


Knut Urdalen's Blog:
Tic Tac Toe with PHP-GTK2
October 12, 2006 @ 09:14:00

Knut Urdalen has come back to PHP-GTK2 (since trying it back in the alpha stage) and decided to give it a shot by porting over an application and seeing how easy it was.

I wanted to see how easy I can take a simple GTK application written in another language and port it to PHP-GTK2. I ended up porting this Ruby/Gtk example written by Daniel Lichtenberger which have some logic, dialogs, events and some graphics.

His experience was a pleasant one, finding that most of the code came over easily, if not directly (well, with syntax chnages, of course). There were a few issues with pulling in the graphics, but over all, it went well. If you'd like to check out the source for the game, you can download it here and (with PHP-GTK2 installed) run it with a simple "php tictactoe.phpw" command.

1 comment voice your opinion now!
tictactoe phpgtk2 port ruby download experience tictactoe phpgtk2 port ruby download experience



Community Events





Don't see your event here?
Let us know!


voicesoftheelephpant release framework series laravel zendserver community package interview opinion library install deployment podcast bugfix symfony unittest introduction api language

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework