Your SlideShare is downloading. ×
How to write PHPT tests
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

How to write PHPT tests

1,137
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,137
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Writing PHP Tests PHPNW TestFest 2009 Wednesday, 27 May 2009
  • 2. Goals Increase test coverage in PHP Win an elePHPant Have Fun Beat London Cheat if we have to Wednesday, 27 May 2009
  • 3. Preparation Grab gcc, autotools, flex-old, bison Make your directory ~/testfest Wednesday, 27 May 2009
  • 4. Snapshot CVS Checkout Snapshot (snaps.php.net) Windows Snapshot (windows.php.net/snapshots/) Wednesday, 27 May 2009
  • 5. Windows run-tests.php PHP 5.3 http://short.ie/yui3db PHP 5.2 http://short.ie/zm5vwb Relax Wednesday, 27 May 2009
  • 6. Building cd ~/testfest ./configure --disable-all --enable-spl make / make -j3 Wednesday, 27 May 2009
  • 7. Checking it worked sapi/cli/php -v make test (takes a while) Submit a report Wednesday, 27 May 2009
  • 8. Running Selective Tests run run-tests.php manually set TEST_PHP_EXECUTABLE Wednesday, 27 May 2009
  • 9. Demo Wednesday, 27 May 2009
  • 10. What makes a phpt? Small Collection of PHP Scripts Separated by section markers TEST, FILE, EXPECT Wednesday, 27 May 2009
  • 11. phpt bits --TEST-- Description of the test --FILE-- Contents is passed to PHP --EXPECT-- The expected output Wednesday, 27 May 2009
  • 12. A simple phpt Wednesday, 27 May 2009
  • 13. Other sections --CREDITS-- --SKIPIF-- --EXPECTF-- Wednesday, 27 May 2009
  • 14. Sample Test Wednesday, 27 May 2009
  • 15. SPL Standard PHP Library Solves Common Problems Data structures, algorithms, iterators Wednesday, 27 May 2009
  • 16. SPL Documentation http://php.net/~helly/ http://uk2.php.net/spl Wednesday, 27 May 2009
  • 17. Our Goals Write a simple basic test Write a test for SPLFixedArray, SPLDoublyLinkedList Look at some iterator tests Wednesday, 27 May 2009
  • 18. SVN Checkout SVN Command Line Tortoise SVN Versions on OSX http://testfest.php.net/repos/ testfest/NorthWestUG/ Wednesday, 27 May 2009
  • 19. Run test SVN: http://testfest.php.net/repos/ testfest/NorthWestUG/ Linux: export TEST_PHP_EXECUTABLE=/path/ to/checkout/sapi/cli/php Windows: set TEST_PHP_EXECUTABLE=c:path tophp.exe php run-tests.php /path/to/svntestfest/ ext/spl/tests Wednesday, 27 May 2009
  • 20. URLs http://qa.php.net/ phpt_details.php http://qa.php.net/write-test.php http://uk.php.net/spl Wednesday, 27 May 2009

×