GOAL - BEST PRACTICE TEST DRIVEN DEVELOPMENT
To achieve a Best Practice Zend Framework skeleton project. Using Doctrine ORM with full Code Coverage on the Doctrine Models and with Database Migrations. Using PHPUnit, Ant & Jenkins for Continous Integration and PHPDocumentor for our API documents. Using jQuery to progessively enhance the UI.
Together we can achieve this! FORK ME!
Follow the latest updates of this project on twitter http://twitter.com/eddiejaoude_git
Project builds on jenkins ci http://build.jaoudestudios.com:8080
Projects using this base: (send me your links) https://github.com/eddiejaoude/github-adv-search
KVM Virtual Machine (VM) hard disk download: coming soon [Ubuntu server 11.04]
- ZF Modular (modules) structure
- auth module
- register (inc. captcha)
- custom controller plugin helpers
- custom controller action helpers
- flash message (flashMessenger) helper usable from any controller action
- ACL (in acl branch)
- auth module
- Unit testing
- setup & configured
- high code coverage
- Best practice php tools
- phpdcd (coming soon)
- phantm - PHp ANalzer for Type Mismatches (https://github.com/colder/phantm) (coming soon)
- padawan - code antipatterns and "smells" (https://github.com/mayflowergmbh/padawan) (coming soon)
- PHP Security Audit Tool (http://sourceforge.net/projects/phpsecaudit/) (coming soon)
- Ant build scripts for Continuous Integration
- Selenium rc tests driven by phpunit
- Ant deploy script including 'dry run' mode (coming soon)
- Zend Framework 1.11+
- Doctrine 2+
- PHPUnit 3.5+
- PHP Documentor (deprecated)
OTHER TECHNOLOGIES REQUIRED
- PHP 5.3+
- Xdebug 2.x
- MySQL 5.x
- Jenkins (formally Hudson) [selenium: optional]
- Pear: Testing_Selenium-0.4.4
- Selenium rc (included in test directory)
ADVANTAGES of TDD (Test Driven Developement)
- Improved stability
- Refactoring - code can be improved without breaking
- Test first - improves code planning
- High code coverage reports - shows what code is not tested yet
cd tests/ [unit tests only - comment out selenium lines in /tests/phpunit.xml] Comment out selenium lines in tests/phpunit.xml phpunit [selenium tests only - uncomment selenium lines in /tests/phpunit.xml] sh selenium_only.sh phpunit --filter Selenium [selenium tests with Penetration testing by Zap proxy - uncomment selenium lines in /tests/phpunit.xml] sh selenium_with_zap.sh phpunit --filter Selenium [all tests - with/without pen test (zap proxy)] phpunit OR ant
- Navigation to root directory of project (ie. application,data,docs,library etc)
- Create the database with the following command
mysql -u[username] -p[password] [database] < data/accounts.sql mysql -u[username] -p[password] [database] < data/account_audit.sql
- Create apache vhost, with config: <VirtualHost *:80> DocumentRoot /var/www/vhosts/js.skeleton/httpdocs/public ServerName js.skeleton <Directory /var/www/vhosts/js.skeleton/httpdocs/public> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all
Zend Framework Zend Framework is an open source framework for developing web applications and services with PHP 5. Zend Framework is implemented using 100% object-oriented code. The component structure of Zend Framework is somewhat unique; each component is designed with few dependencies on other components. This loosely coupled architecture allows developers to use components individually. We often call this a "use-at-will" design. While they can be used separately, Zend Framework components in the standard library form a powerful and extensible web application framework when combined. Zend Framework offers a robust, high performance MVC implementation, a database abstraction that is simple to use, and a forms component that implements HTML form rendering, validation, and filtering so that developers can consolidate all of these operations using one easy-to-use, object oriented interface. Other components, such as Zend_Auth and Zend_Acl, provide user authentication and authorization against all common credential stores. Still others implement client libraries to simply access to the most popular web services available. Whatever your application needs are, you're likely to find a Zend Framework component that can be used to dramatically reduce development time with a thoroughly tested foundation.
Doctrine Doctrine is an object relational mapper (ORM) for PHP 5.2.3+ that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.
PHPUnit Even good programmers make mistakes. The difference between a good programmer and a bad programmer is that the good programmer uses tests to detect his mistakes as soon as possible. The sooner you test for a mistake the greater your chance of finding it and the less it will cost to find and fix. This explains why leaving testing until just before releasing software is so problematic. Most errors do not get caught at all, and the cost of fixing the ones you do catch is so high that you have to perform triage with the errors because you just cannot afford to fix them all.
Testing with PHPUnit is not a totally different activity from what you should already be doing. It is just a different way of doing it. The difference is between testing, that is, checking that your program behaves as expected, and performing a battery of tests, runnable code-fragments that automatically test the correctness of parts (units) of the software. These runnable code-fragments are called unit tests.
- Jenkins Jenkins monitors executions of repeated jobs, such as building a software project or jobs run by cron. Among those things, current Jenkins focuses on the following two jobs:
- Building/testing software projects continuously, just like CruiseControl or DamageControl. In a nutshell, Jenkins provides an easy-to-use so-called continuous integration system, making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. The automated, continuous build increases the productivity.
- Monitoring executions of externally-run jobs, such as cron jobs and procmail jobs, even those that are run on a remote machine. For example, with cron, all you receive is regular e-mails that capture the output, and it is up to you to look at them diligently and notice when it broke. Jenkins keeps those outputs and makes it easy for you to notice when something is wrong.
PHPDocumentor phpDocumentor uses an extensive templating system to change your source code comments into human readable, and hence useful, formats. This system allows the creation of easy to read documentation in 15 different pre-designed HTML versions, PDF format, Windows Helpfile CHM format, and in Docbook XML. You can also create your own templates to match the look and feel of your project.
OWASP Zed Attack Proxy (ZAP) The OWASP Zed Attack Proxy (ZAP) is an easy to use integrated penetration testing tool for finding vulnerabilities in web applications. It is designed to be used by people with a wide range of security experience and as such is ideal for developers and functional testers who are new to penetration testing as well as being a useful addition to an experienced pen testers toolbox.