?????????????????????????? PHP ??????????????????????????????????????????????з??????о?????????????????????? PHP ??????????Ч????????????????????????????????????????????????? PHP ??????????????????????????????????????????????????????????У???????????????

????PHP ???????????????????

 

????????????? PHP ?1???汾 5.2.8 ??????? LINUX ????????????????????????????? PHP ????????????? PHPT ?????

 

??????????????? PHPT ???

 

????PHP ???????????? .phpt ???????????? TEST??FILE??EXPECT ????????????????? PHPT ????????????У?TEST??FILE??EXPECT ?????????????????????????????????????????????У?TEST ?ο?????????д??????????????; FILE ??????? PHP ??????????????; EXPECT ????????????????????????????????????У?PHP ?????????? PHP ????ж???????? FILE ???е??????????????????????????????? EXPECT ?????е?????;????????????????£?????????;???????£??????????

 

?????? 1 ?г???????????????????????????????????

?????? 1. PHP ???????е???????

???????????????????

 

????TEST??????????????????

 

????ARGSFILE ?ε??????????????

????SKIPIF??????????????????????

 

????POST??????????? POST ???????????????? POST ?Σ??????????? SKIPIF ?Σ??磺

????--SKIPIF--

????GET??????????? GET ???????????????? POST ?Σ??????????? SKIPIF ?Σ??磺

????--SKIPIF--


????INI???????????? ini ?????????????? foo=bar ?????????????? ini_get(string name_entry) ??á?

 

????FILE?????????????????? PHP ??????д???????????е??????? EXPECT* ?ε???????????

 

????EXPECT???????????????????

 

????EXPECTF?????????????????ú??? sscanf() ?е??????????EXPECT ?ε????

????EXPECTREGEX??????????????????????????????EXPECT ?ε????


?????????????????????? ?? 001.phpt ?? ???(???嵥 1)???? TEST ?ε????????????????? PHP ?汾?????????????????? SKIPIF ?ε?????д???? ?? skipip.inc ?? ??????? FILE ?????????????????????? TEST_PHP_EXECUTABLE ?????????? PHP ??汾??????????????????? EXPECTF ?е???????и??????

?????嵥 1. PHPT ?????? ?? 001.phpt ?? ???

????--TEST--


????version string

????--SKIPIF--

????--FILE--

????$php = getenv(??TEST_PHP_EXECUTABLE??);

????var_dump(`$php -n -v`);


????echo "Done ";

?????>


????--EXPECTF--

????string(%d) "PHP %s (cli) (built: %s)%s


????Copyright (c) 1997-20%d The PHP Group

 

????Zend Engine v%s?? Copyright (c) 1998-20%d Zend Technologies


????"

????Done


??????????? PHP ???????????

?????????в?????????????????????? PHP ???????????ж???


?????????????????????????? 2 ?н???????????????????????????á?


?????? 2. PHP ??????????е????????????

?????????????? ????????? ????


????TEST_PHP_EXECUTABLE?趨????????? PHP?????? ?? auto ?? ???????? ?? auto ?? ???????? CGI ??????? ?? ./sapi/cgi/php-cgi ?? ;????? CLI ??????? ?? ./sapi/cli/php ?? ??TEST_PHP_EXECUTABLE=

 

????$HOME/php-5.2.8/sapi/cli/php


????TEST_PHP_DETAILED?趨????????????????????????? 1 ???? 0 ??TEST_PHP_DETAILED=1

 

????TEST_PHP_USER?趨??????????????????TEST_PHP_DETAILED= ?? /usr/test1 ??

 

????TEST_PHP_LOG_FORMAT

?????趨??????????????? ?? LEOD ?? ?????????????? L ??????????????? ?? .log ?? ?????E ???? ?? .exp ?? ??O ???? ?? .out ?? ??D ???? ?? .diff ?? ??TEST_PHP_LOG_FORMAT="LD"

??????????У??? Bash ????????????????????£?

?????嵥 2. ??????????????

????export HOME=/home/user_dir/

 

????export TEST_PHP_EXECUTABLE=$HOME/php-5.2.8/sapi/cli/php


????export TEST_PHP_DETAILED=1


????export TEST_PHP_LOG_FORMAT="LEOD"

???????????????ú???????? PHP ????ж?????????? ?? $HOME/php-5.2.8/sapi/cli/ ?? ?±???????? ?? php ?? ??????????

??????в?????????軔?????? PHPT ???????? ?? .phpt ?? ??????????????????????????? ?? 001.phpt ?? ????????????£?

?????嵥 3. PHPT ????????????

????bash-2.03$ cd $HOME/php-5.2.8/

????bash-2.03$ $HOME/php-5.2.8/sapi/cli/php run-tests.php


????$HOME/php-5.2.8/sapi/cli/tests/001.phpt

????????ò???????????????????????£??????????????????????£?


?????嵥 4. PHPT ????????????