Jump to: navigation, search

Difference between revisions of "PDTT - PHP 5.3 Code Assist Tests"

(pdtt - Test Your PHP 5.3 Code Assist)
Line 1: Line 1:
== pdtt - Test Your PHP 5.3 Code Assist ==
+
== pdtt - Test PHP 5.3 Code Assist ==
<pre>
+
<pre> pdtt is a clone of the popular phpt </pre>
(pdtt is a clone of the popular phpt)
+
</pre>
+
 
The first thing you need to know about tests is that we need more!!! Although Eclipse PDT works just great 99.99% of the time, not having a very comprehensive test suite means that we take more risks every time we add to or modify the Eclipse PDT Code Assist Engine implementation. The second thing you need to know is that if you can write PHP you can write tests. Thirdly - we are a friendly and welcoming community, don't be scared about writing to (pdt-dev@eclipse.org) - we won't bite!
 
The first thing you need to know about tests is that we need more!!! Although Eclipse PDT works just great 99.99% of the time, not having a very comprehensive test suite means that we take more risks every time we add to or modify the Eclipse PDT Code Assist Engine implementation. The second thing you need to know is that if you can write PHP you can write tests. Thirdly - we are a friendly and welcoming community, don't be scared about writing to (pdt-dev@eclipse.org) - we won't bite!
  
 
=== General ===
 
=== General ===
 
==== So what are phpt tests? ====  
 
==== So what are phpt tests? ====  
A phpt test is a little script used by the php internal and quality assurance teams to test PHP's functionality. It can be used with new releases to make sure they can do all the things that previous releases can, or to help find bugs in current releases. By writing phpt tests you are helping to make PHP more stable.
+
A pdtt test is a little script used by the pdt internal and quality assurance teams to test Eclipse PDT's code assist functionality. It can be used with new releases to make sure they can do all the things that previous releases can, or to help find bugs in current releases. By writing pdtt tests you are helping to make Eclipse PDT more stable.
====What skills are needed to write a phpt test?====
+
====What skills are needed to write a pdtt test?====
All that is really needed to write a phpt test is a basic understanding of the PHP language, a text editor, and a way to get the results of your code. That is it. So if you have been writing and running PHP scripts already - you have everything you need.
+
All that is really needed to write a pdtt test is a basic understanding of the PHP language, a text editor, and a way to get the results of your code. That is it. So if you have been writing and running PHP scripts already - you have everything you need.
====What do you write phpt tests on?====
+
====What do you write pdtt tests on?====
Basically you can write a phpt test on one of the various php functions available. You can write a test on a basic language function (a string function or an array function) , or a function provided by one of PHP's numerous extensions (a mysql function or a image function or a mcrypt function).
+
Basically you can write a pdtt test on one of the various code assist scenarios available. You can write a test on a basic language element (a type, function or variable).
You can find out what functions already have phpt tests by looking in the html version of the cvs (php-src/ext/standard/tests/ is a good place to start looking - though not all the tests currently written are in there). If you look at the gcov pages you can see which functions have lots of tests and which need more, although these pages only show which lines of code are covered by test cases so even if the coverage looks good there may be more interesting tests to write - for example covering error cases. There is also a table here that shows which functions and methods are called from PHPT tests.
+
If you want more guidance than that you can always ask the PHP Quality Assurance Team on their mailing list (pdt-dev@eclipse.org) where they would like you to direct your attentions.
If you want more guidance than that you can always ask the PHP Quality Assurance Team on their mailing list (php-qa@lists.php.net) where they would like you to direct your attentions.
+
====How is a pdtt test is used?====
====How is a phpt test is used?====
+
When a test is called by the Test script it takes various parts of the phpt file to name and create a .php file. That .php file is then executed. The output of the .php file is then compared to a different section of the phpt file. If the output of the script "matches" the output provided in the phpt script - it passes.
When a test is called by the run-test.php script it takes various parts of the phpt file to name and create a .php file. That .php file is then executed. The output of the .php file is then compared to a different section of the phpt file. If the output of the script "matches" the output provided in the phpt script - it passes.
+
 
====What should a phpt test do?====
 
====What should a phpt test do?====
 
Basically - it should try and break the PHP function. It should check not only the functions normal parameters, but it should also check edge cases. Intentionally generating an error is allowed and encouraged.
 
Basically - it should try and break the PHP function. It should check not only the functions normal parameters, but it should also check edge cases. Intentionally generating an error is allowed and encouraged.

Revision as of 04:05, 17 February 2009

pdtt - Test PHP 5.3 Code Assist

 pdtt is a clone of the popular phpt 

The first thing you need to know about tests is that we need more!!! Although Eclipse PDT works just great 99.99% of the time, not having a very comprehensive test suite means that we take more risks every time we add to or modify the Eclipse PDT Code Assist Engine implementation. The second thing you need to know is that if you can write PHP you can write tests. Thirdly - we are a friendly and welcoming community, don't be scared about writing to (pdt-dev@eclipse.org) - we won't bite!

General

So what are phpt tests?

A pdtt test is a little script used by the pdt internal and quality assurance teams to test Eclipse PDT's code assist functionality. It can be used with new releases to make sure they can do all the things that previous releases can, or to help find bugs in current releases. By writing pdtt tests you are helping to make Eclipse PDT more stable.

What skills are needed to write a pdtt test?

All that is really needed to write a pdtt test is a basic understanding of the PHP language, a text editor, and a way to get the results of your code. That is it. So if you have been writing and running PHP scripts already - you have everything you need.

What do you write pdtt tests on?

Basically you can write a pdtt test on one of the various code assist scenarios available. You can write a test on a basic language element (a type, function or variable). If you want more guidance than that you can always ask the PHP Quality Assurance Team on their mailing list (pdt-dev@eclipse.org) where they would like you to direct your attentions.

How is a pdtt test is used?

When a test is called by the Test script it takes various parts of the phpt file to name and create a .php file. That .php file is then executed. The output of the .php file is then compared to a different section of the phpt file. If the output of the script "matches" the output provided in the phpt script - it passes.

What should a phpt test do?

Basically - it should try and break the PHP function. It should check not only the functions normal parameters, but it should also check edge cases. Intentionally generating an error is allowed and encouraged.


Template

Providing ... Case


Tests

1. Case: <? class A {} $a = new | ?>

  Study: