svn: /phpdoc/en/trunk/reference/mongo/ testing.xml

From: Date: Mon, 23 May 2011 20:07:22 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/ testing.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-8167@lists.php.net to get a copy of this message
kristina Mon, 23 May 2011 20:07:22 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=311360 Log: added c tests Changed paths: U phpdoc/en/trunk/reference/mongo/testing.xml Modified: phpdoc/en/trunk/reference/mongo/testing.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/testing.xml 2011-05-23 17:36:59 UTC (rev 311359) +++ phpdoc/en/trunk/reference/mongo/testing.xml 2011-05-23 20:07:22 UTC (rev 311360) @@ -5,37 +5,95 @@ <title>Running the Driver's Tests</title> <para> - The PECL package does not come with the PHP tests, but they are available at - <link xlink:href="&url.mongodb.github;">Github</link>. Download the driver - source and there are tests in the tests/ directory. The driver uses - <link xlink:href="&url.phpunit.install;">PHPUnit</link> for testing, which can - be installed via PEAR. + The PECL package does not come with the tests, but they are available at + <link xlink:href="&url.mongodb.github;">Github</link>. There are two types of + tests: the PHPUnit tests and the C tests. </para> - <para> - You must set <literal>error_reporting</literal> in php.ini to - <literal>E_STRICT | E_ALL</literal> for all of the tests to pass. If you do - not, you will get some failures that say the test was expecting a warning or - error. - </para> - <para> - To run the tests, make sure that there is a MongoDB server running locally on - port 27017. Make sure you're in the main directory of the driver source you - downloaded from Github. Run: - </para> - <programlisting> + + <section> + <title>PHPUnit Tests</title> + <para> + To run the tests, you must download the driver from Github (the tests are in + the <literal>tests/</literal> directory). You'll also need + <link xlink:href="&url.phpunit.install;">PHPUnit</link> to run the tests. + PHPUnit can be installed via PEAR (although you should look at the + installation instructions, it requires a couple of prerequisites). + </para> + <para> + Some tests expect warnings or errors, so you must set + <literal>error_reporting</literal> in <literal>php.ini</literal> to + <literal>E_STRICT | E_ALL</literal> for these tests to pass. If you do + not, you will get some failures that say the test was expecting a warning or + error. + </para> + <para> + To run the tests, make sure that there is a MongoDB server running locally on + port 27017. Before reporting errors, please try running the tests against the + latest development version of MongoDB: often there are tests for features that + aren't yet in the stable release. + </para> + <para> + The test suite uses the "phpunit" database. If you are using a database + called "phpunit" in your application, make sure point MongoDB at a different + data directory before running the tests. + </para> + <para> + Make sure you're in the main directory of the driver source you + downloaded from Github. Run: + </para> + <programlisting> <![CDATA[ $ phpunit tests/MongoSuite.php ]]> </programlisting> - <para> - Please report any failures or errors in the - <link xlink:href="&url.mongodb.jira;">bugtracker</link>. There may be skipped - tests, these are normal and can be ignored. - </para> - <para> - New tests are always welcome! Please feel free to contribute new tests of any - type testing any functionality. - </para> + </section> + + <section> + <title>C Tests</title> + <para> + The C tests mostly check internal functions that are not exposed through PHP. + If you'd like to run these tests, you'll need to compile PHP with the + <literal>--enable-embed</literal> flag. Then switch to the + <filename>tests</filename> directory and run <literal>make</literal>. This + will create a binary called <literal>unit</literal>. Run + <literal>unit</literal> to execute the tests. These tests do no require a + database to be running. + </para> + + <para> + If a test passes, it will print a ".". If a test fails, it will assert and + stop the tests. Please report any asserts. + </para> + + <para> + If <literal>make</literal> cannot find your PHP embedded library (libphp5.so) + or header files, you may have to specify the <literal>PHP_PATH</literal> + variable. + </para> + + <para> + Run <literal>make clean</literal> to remove all testing objects. + </para> + + <para> + If you run these tests with <filename>valgrind</filename>, you should get no + invalid memory access errors and the "no leaks are possible" message at the + end. + </para> + </section> + + <section> + <title>Reporting Errors</title> + <para> + Please report any failures or errors in the + <link xlink:href="&url.mongodb.jira;">bugtracker</link>. There may be skipped + tests, these are normal and can be ignored. + </para> + <para> + New tests are always welcome! Please feel free to contribute new tests of any + type testing any functionality. + </para> + </section> </section>

« previous php.doc.cvs (#8167) next »