PDO has a set of "core" tests that all drivers should pass before being released. They're designed to run from the PHP source distribution, so running the tests for your driver requires moving things around a bit. The suggested procedure is to obtain the latest PHP 5.1 snapshot and perform the following step:

$ cp -r pdo_SKEL /path/to/php-5.1/ext

This will allow the test harness to run your tests. The next thing you need to do is create a test that will redirect into the PDO common core tests. The convention is to name this filecommon.phpt; it should be placed in the tests subdirectory that was created byext_skelwhen you created your extension skeleton. The content of this file should look something like the following:

--TEST-- SKEL --SKIPIF-- <?php # vim:ft=php if(!extension_loaded('pdo_SKEL'))print 'skip'; ?> --REDIRECTTEST-- if(false !== getenv('PDO_SKEL_TEST_DSN')){# user set them from their shell $config['ENV']['PDOTEST_DSN'] = getenv('PDO_SKEL_TEST_DSN'); $config['ENV']['PDOTEST_USER'] = getenv('PDO_SKEL_TEST_USER'); $config['ENV']['PDOTEST_PASS'] = getenv('PDO_SKEL_TEST_PASS'); if(false !== getenv('PDO_SKEL_TEST_ATTR')){$config['ENV']['PDOTEST_ATTR'] = getenv('PDO_SKEL_TEST_ATTR');}return $config;}return array('ENV' => array('PDOTEST_DSN' => 'SKEL:dsn', 'PDOTEST_USER' => 'username', 'PDOTEST_PASS' => 'password'), 'TESTS' => 'ext/pdo/tests');

This will cause the common core tests to be run, passing the values ofPDOTEST_DSN,PDOTEST_USERandPDOTEST_PASSto the PDO constructor as thedsn,usernameandpasswordparameters. It will first check the environment, so that appropriate values can be passed in when the test harness is run, rather than hard-coding the database credentials into the test file.

淘宝 adsense 商品推荐

官方正版 Google AdSense实战宝典 用谷歌广告联盟出海赚美元 第2版 祁劲松 网站运营书籍 seo搜索引擎优化 AdSense从入门到精通


The test harness can be invoked as follows:

$ cd /path/to/php-5.1
$ make TESTS=ext/pdo_SKEL/tests PDO_SKEL_TEST_DSN="skel:dsn" \