Get the code:
$ mkdir -p ~/php/uframework $ wget https://raw.github.com/willdurand-edu/php-practicals/master/files/ufw.tgz -O ~/php/uframework/ufw.tgz $ cd ~/php/uframework $ tar xvzf ufw.tgz $ rm !$
PHPUnit is a PHP testing framework part of the xUnit family. To install it globally, you can run the following commands:
$ wget http://phar.phpunit.de/phpunit.phar $ chmod a+x phpunit.phar $ mkdir ~/.bin $ mv phpunit.phar ~/.bin/phpunit
Edit (or create) your
.bashrc to add the
~/.bin directory to your
Run a test suite using the following command:
Anatomy of µFramework
The directory layout looks like this:
├ app/ # the application directory ├ src/ # the framework sources ├ tests/ # the test suite ├ web/ # public directory └ autoload.php
Your application controllers will be registered as closures in
Templates will be put into the
The framework sources. You will have to complete the missing parts.
The test suite, all tests have to pass at the end :)
Contains the public files. Most of the time, we put assets (CSS, JS files)
index.php file is the only entry point of your application. It is called
a front controller.
In the previous practical, you wrote a PSR-0 compliant autoloader. The
µFramework has a
autoload.php file, but it iss empty.
Run the test suite to ensure everything works:
Cool. See you next week!
You can jump to: Practical Work #3.