2. What is a Testfest?
Fun gathering for PHP programmers
and the like.
Concentrating on writing unit tests.
Making PHP better.
Get your name into PHP credits.
Drink free beer.
∂ WHAT IS IN IT FOR ME?
3. What is OUR Testfest?
Mini test fest (evening instead of a full day)
Maybe more often?
Maybe full days?
You decide,..
4. How to write a test (1)
Simple text file with a bit of PHP code
Test each component separately
One test per .PHPT file
5. How to write a test (2)
Bug: bug1234.phpt
Feature: <function>_basic.phpt
Error: <function>_error.phpt
Global: <extension><nr>.phpt
∂ NAMING CONVENTIONS
6. How to write a test (3)
--TEST--
--CREDITS--
--SKIPIF--
--FILE--
--EXPECT-- / --EXPECTF--
--CLEAN--
∂ PHPT SECTIONS
7. How to write a test (4)
--TEST--
Trivial "Hello World" test
--FILE--
<?php echo "Hello World"?>
--EXPECT--
Hello World
∂ EXAMPLE TEST (test/basic/001.phpt)
8. How to write a test (5)
--TEST--
Check if echo works
--CREDITS--
Joshua Thijssen <jthijssen@enrise.com>
# Enrise TestFest 2011-02-11
--FILE--
<?php echo "Hello World"?>
--EXPECT--
Hello World
∂ EXAMPLE TEST
9. How to run your tests (1)
∂ HTTP://TESTFEST.ENRISE.COM
11. What to test?
http://gcov.php.net/PHP_5_3/lcov_html/
DOM (67.8%) STANDARD (78.1%)
IMAP (64.4%) OPENSSL (63.1%)
FTP (60.0%) SQLITE (74.7%)
SNMP (7.8%) ZIP (65.4%)
∂ HIGHER CODE COVERAGE DOES NOT ALWAYS MEAN BETTER TESTS!
12. More information
Check out the URL’s:
http://qa.php.net/write-test.php
http://qa.php.net/phpt_details.php
http://gcov.php.net/
∂ MORE INFO ABOUT PHP UNIT-TESTING
13. More information
When in doubt, ask one us to help you!
∂ WE ARE HERE TO HELP!