cvs: pear /PEAR_PackageFileManager/tests PEAR_PackageFileManager_File_TestCase_setupDirs.php testsuite.php
/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs test_concept.phpt test_valid.phpt

From: Date: Mon, 28 Mar 2005 03:48:38 +0000
Subject: cvs: pear /PEAR_PackageFileManager/tests PEAR_PackageFileManager_File_TestCase_setupDirs.php testsuite.php
/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs test_concept.phpt test_valid.phpt
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-30709@lists.php.net to get a copy of this message
cellog Sun Mar 27 22:48:38 2005 EDT Added files: /pear/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs test_concept.phpt test_valid.phpt Removed files: /pear/PEAR_PackageFileManager/tests PEAR_PackageFileManager_File_TestCase_setupDirs.php Modified files: /pear/PEAR_PackageFileManager/tests testsuite.php Log: more conversion of phpunit -> phpt

http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/tests/testsuite.php?r1=1.24&r2=1.25&ty=u Index: pear/PEAR_PackageFileManager/tests/testsuite.php diff -u pear/PEAR_PackageFileManager/tests/testsuite.php:1.24 pear/PEAR_PackageFileManager/tests/testsuite.php:1.25 --- pear/PEAR_PackageFileManager/tests/testsuite.php:1.24 Sun Mar 27 22:38:25 2005 +++ pear/PEAR_PackageFileManager/tests/testsuite.php Sun Mar 27 22:48:37 2005 @@ -4,7 +4,7 @@ * HTML output for PHPUnit suite tests. * * Copied for PEAR_PackageFileManager from HTML_CSS - * @version $Id: testsuite.php,v 1.24 2005/03/28 03:38:25 cellog Exp $ + * @version $Id: testsuite.php,v 1.25 2005/03/28 03:48:37 cellog Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_CSS */ @@ -57,7 +57,6 @@ 'PEAR_PackageFileManager_TestCase_addMaintainer', 'PEAR_PackageFileManager_TestCase_addConfigureOption', 'PEAR_PackageFileManager_TestCase_addDependency', - 'PEAR_PackageFileManager_File_TestCase_setupDirs', 'PEAR_PackageFileManager_File_TestCase_setDir', 'PEAR_PackageFileManager_XMLOutput_TestCase_1', ); http://cvs.php.net/co.php/pear/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs/test_concept.phpt?r=1.1&p=1 Index: pear/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs/test_concept.phpt +++ pear/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs/test_concept.phpt --TEST-- PEAR_PackageFileManager_File->_setupDirs, proof-of-concept --SKIPIF-- <?php if (@file_exists(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'CVS')) { echo 'skip cannot run in CVS'; } ?> --FILE-- <?php require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'setup.php.inc'; $packagexml->_options['addhiddenfiles'] = false; $packagexml->_options['ignore'] = $packagexml->_options['include'] = false; $packagexml->_setupIgnore(false, 0); $packagexml->_setupIgnore(false, 1); $list = $packagexml->dirList($package_directory = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest'); $struc = array(); foreach($list as $file) { $path = substr(dirname($file), strlen(str_replace(DIRECTORY_SEPARATOR, '/', realpath($package_directory))) + 1); if (!$path) { $path = '/'; } $ext = array_pop(explode('.', $file)); if (strlen($ext) == strlen($file)) { $ext = ''; } $struc[$path][] = array('file' => basename($file), 'ext' => $ext, 'path' => (($path == '/') ? basename($file) : $path . '/' . basename($file)), 'fullpath' => $file); } $phpunit->assertEquals( array( 'blarfoo' => array( array('file' => 'blartest.txt', 'ext' => 'txt', 'path' => 'blarfoo/blartest.txt', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/blarfoo/blartest.txt') ), 'subfoo/subsubfoo' => array( array('file' => 'boo.txt', 'ext' => 'txt', 'path' => 'subfoo/subsubfoo/boo.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/subfoo/subsubfoo/boo.txt') ), 'subfoo' => array( array('file' => 'test11.txt', 'ext' => 'txt', 'path' => 'subfoo/test11.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/subfoo/test11.txt'), array('file' => 'test12.txt', 'ext' => 'txt', 'path' => 'subfoo/test12.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/subfoo/test12.txt'), ), '/' => array( array('file' => 'test1.txt', 'ext' => 'txt', 'path' => 'test1.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/test1.txt'), array('file' => 'test2.txt', 'ext' => 'txt', 'path' => 'test2.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/test2.txt'), ), 'testCVS' => array( 0 => array( 'file' => 'testEntries', 'ext' => '', 'path' => 'testCVS/testEntries', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/testCVS/testEntries', ), array( 'file' => 'testEntries.Extra', 'ext' => 'Extra', 'path' => 'testCVS/testEntries.Extra', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/testCVS/testEntries.Extra', ), ), ), $struc, 'wrong basic structure'); uksort($struc,'strnatcasecmp'); foreach($struc as $key => $ind) { usort($ind, array($packagexml, 'sortfiles')); $struc[$key] = $ind; } $phpunit->assertEquals( array( 'blarfoo' => array( array('file' => 'blartest.txt', 'ext' => 'txt', 'path' => 'blarfoo/blartest.txt', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/blarfoo/blartest.txt') ), 'subfoo/subsubfoo' => array( array('file' => 'boo.txt', 'ext' => 'txt', 'path' => 'subfoo/subsubfoo/boo.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/subfoo/subsubfoo/boo.txt') ), 'subfoo' => array( array('file' => 'test11.txt', 'ext' => 'txt', 'path' => 'subfoo/test11.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/subfoo/test11.txt'), array('file' => 'test12.txt', 'ext' => 'txt', 'path' => 'subfoo/test12.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/subfoo/test12.txt'), ), '/' => array( array('file' => 'test1.txt', 'ext' => 'txt', 'path' => 'test1.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/test1.txt'), array('file' => 'test2.txt', 'ext' => 'txt', 'path' => 'test2.txt', 'fullpath' =>dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/test2.txt'), ), 'testCVS' => array( 0 => array( 'file' => 'testEntries', 'ext' => '', 'path' => 'testCVS/testEntries', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/testCVS/testEntries', ), array( 'file' => 'testEntries.Extra', 'ext' => 'Extra', 'path' => 'testCVS/testEntries.Extra', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/testCVS/testEntries.Extra', ), ), ), $struc, 'wrong sorted structure'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs/test_valid.phpt?r=1.1&p=1 Index: pear/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs/test_valid.phpt +++ pear/PEAR_PackageFileManager/tests/PEAR_PackageFileManager_File/setupDirs/test_valid.phpt --TEST-- PEAR_PackageFileManager_File->_setupDirs, valid test --SKIPIF-- --FILE-- <?php require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'setup.php.inc'; $packagexml->_options['addhiddenfiles'] = false; $packagexml->_options['ignore'] = $packagexml->_options['include'] = false; $packagexml->_setupIgnore(false, 0); $packagexml->_setupIgnore(false, 1); $list = $packagexml->dirList($package_directory = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest'); $struc = array(); foreach($list as $file) { $path = substr(dirname($file), strlen(str_replace(DIRECTORY_SEPARATOR, '/', realpath($package_directory))) + 1); if (!$path) { $path = '/'; } $ext = array_pop(explode('.', $file)); if (strlen($ext) == strlen($file)) { $ext = ''; } $struc[$path][] = array('file' => basename($file), 'ext' => $ext, 'path' => (($path == '/') ? basename($file) : $path . '/' . basename($file)), 'fullpath' => $file); } uksort($struc,'strnatcasecmp'); foreach($struc as $key => $ind) { usort($ind, array($packagexml, 'sortfiles')); $struc[$key] = $ind; } $test = $packagexml->_setupDirs($struc['/'], explode('/','subfoo/subsubfoo'), $struc['subfoo/subsubfoo']); $phpunit->assertEquals( array( 0 => array('file' => 'test1.txt', 'ext' => 'txt', 'path' => 'test1.txt', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/test1.txt'), 1 => array('file' => 'test2.txt', 'ext' => 'txt', 'path' => 'test2.txt', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/test2.txt'), 'subfoo' => array( 'subsubfoo' => array( array('file' => 'boo.txt', 'ext' => 'txt', 'path' => 'subfoo/subsubfoo/boo.txt', 'fullpath' => dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'footest/subfoo/subsubfoo/boo.txt') ), ), ), $test, 'incorrect parsing' ); echo 'tests done'; ?> --EXPECT-- tests done
« previous php.pear.cvs (#30709) next »