cvs: pear-core /tests pear_common_buildProvidesArray.phpt /tests/PEAR_Common test_buildProvidesArray.phpt

From: Date: Mon, 01 Nov 2004 02:09:07 +0000
Subject: cvs: pear-core /tests pear_common_buildProvidesArray.phpt /tests/PEAR_Common test_buildProvidesArray.phpt
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-1200@lists.php.net to get a copy of this message
cellog Sun Oct 31 21:09:07 2004 EDT Added files: /pear-core/tests/PEAR_Common test_buildProvidesArray.phpt Removed files: /pear-core/tests pear_common_buildProvidesArray.phpt Log: move test to new testing format http://cvs.php.net/co.php/pear-core/tests/PEAR_Common/test_buildProvidesArray.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Common/test_buildProvidesArray.phpt +++ pear-core/tests/PEAR_Common/test_buildProvidesArray.phpt --TEST-- PEAR_Common::buildProvidesArray test --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } if (!function_exists('token_get_all')) { echo 'skip'; } ?> --FILE-- <?php require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; $phpunit->assertFalse(PEAR_Common::analyzeSourceCode('=+"\\//452'), 'invalid filename'); $testdir = $statedir; @mkdir($testdir); $test5 = ' <?php function test() { } if (trytofool) { function fool() { } } class test2 { function test2() { parent::unused(); Greg::classes(); $a = new Pierre; } } class blah extends test2 { /** * @nodep Stig */ function blah() { Stig::rules(); } } ?> '; $fp = fopen($testdir . DIRECTORY_SEPARATOR . 'test5.php', 'w'); fwrite($fp, $test5); fclose($fp); $ret = PEAR_Common::analyzeSourceCode($testdir . DIRECTORY_SEPARATOR . 'test5.php'); $phpunit->assertNoErrors('1st valid PHP'); $phpunit->showall(); $phpunit->assertEquals(array ( 'source_file' => $testdir . DIRECTORY_SEPARATOR . 'test5.php', 'declared_classes' => array ( 0 => 'test2', 1 => 'blah', ), 'declared_interfaces' => array ( ), 'declared_methods' => array ( 'test2' => array ( 0 => 'test2', ), 'blah' => array ( 0 => 'blah', ), ), 'declared_functions' => array ( 0 => 'test', 1 => 'fool', ), 'used_classes' => array ( 0 => 'Greg', 1 => 'Pierre', ), 'inheritance' => array ( 'blah' => 'test2', ), 'implements' => array ( ), ), $ret, 'wrong return value, 1st valid PHP test'); $common = new PEAR_Common; $ret2 = $common->buildProvidesArray($ret); $phpunit->assertNoErrors('provides'); $phpunit->showall(); $phpunit->assertEquals(array ( 'provides' => array ( 'class;test2' => array ( 'file' => 'test5.php', 'type' => 'class', 'name' => 'test2', ), 'class;blah' => array ( 'file' => 'test5.php', 'type' => 'class', 'name' => 'blah', 'extends' => 'test2', ), 'function;test' => array ( 'file' => 'test5.php', 'type' => 'function', 'name' => 'test', ), 'function;fool' => array ( 'file' => 'test5.php', 'type' => 'function', 'name' => 'fool', ), ), ), $common->pkginfo, 'provides'); echo 'tests done'; ?> --EXPECT-- tests done

« previous php.pear.core (#1200) next »