Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Set include_path in such a way that tests can be run from anywhere an…

…d pick up the right files to be tested.

git-svn-id: http://svn.php.net/repository/pear/packages/PEAR_PackageFileManager/trunk@322107 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 1a6beb6b2d6ed92efee74ea20bf8dd9fb15b335e 1 parent 970d2c8
Daniel Convissor authored

Showing 3 changed files with 35 additions and 2 deletions. Show diff stats Hide diff stats

  1. +3 1 package.xml
  2. +3 1 package_PFM1.xml
  3. +29 0 tests/setup.php.inc
4 package.xml
@@ -141,7 +141,9 @@ Features include
141 141 </dir> <!-- /tests/PEAR_PackageFileManager2/writePackageFile -->
142 142 </dir> <!-- /tests/PEAR_PackageFileManager2 -->
143 143 <file name="phpt_test.php.inc" role="test" />
144   - <file name="setup.php.inc" role="test" />
  144 + <file name="setup.php.inc" role="test">
  145 + <tasks:replace from="@php_dir@" to="php_dir" type="pear-config" />
  146 + </file>
145 147 </dir> <!-- /tests -->
146 148 <file name="LICENSE" role="doc" />
147 149 <file name="PackageFileManager2.php" role="php">
4 package_PFM1.xml
@@ -150,7 +150,9 @@ No changes since alpha1
150 150 </dir> <!-- /tests/setOptions -->
151 151 <file name="Bad_file.php" role="test" />
152 152 <file name="phpt_test.php.inc" role="test" />
153   - <file name="setup.php.inc" role="test" />
  153 + <file name="setup.php.inc" role="test">
  154 + <tasks:replace from="@php_dir@" to="php_dir" type="pear-config" />
  155 + </file>
154 156 <file name="test1_package.xml" role="test" />
155 157 <file name="Test_file.php" role="test" />
156 158 </dir> <!-- /tests -->
29 tests/setup.php.inc
... ... @@ -1,4 +1,33 @@
1 1 <?php
  2 +
  3 +/*
  4 + * Set include path so tests can be run from anywhere.
  5 + */
  6 +
  7 +if ('@php_dir@' == '@'.'php_dir'.'@') {
  8 + // This package hasn't been installed, use parent of this dir.
  9 + $php_dir = dirname(dirname(__FILE__));
  10 +} else {
  11 + $php_dir = '@php_dir@';
  12 +}
  13 +
  14 +$dirs = array(
  15 + dirname($_SERVER['PHP_SELF']),
  16 + dirname(dirname($_SERVER['PHP_SELF'])),
  17 + dirname(__FILE__),
  18 + $php_dir,
  19 + '.',
  20 +);
  21 +
  22 +$dirs = array_merge($dirs, explode(PATH_SEPARATOR, get_include_path()));
  23 +$dirs = array_unique($dirs);
  24 +set_include_path(implode(PATH_SEPARATOR, $dirs));
  25 +
  26 +
  27 +/*
  28 + * Other tasks.
  29 + */
  30 +
2 31 require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc';
3 32 require_once 'PEAR/PackageFileManager.php';
4 33 $pfm = new PEAR_PackageFileManager;

0 comments on commit 1a6beb6

Please sign in to comment.
Something went wrong with that request. Please try again.