1

I keep getting an error when I try to include simpletest in my include_path:

<?
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(basename(dirname(__FILE__)) . '/../../'));

include 'simpletest/autorun.php';

returns:

.:/usr/lib/php:/Users/kristiannissen/Documents/php
Warning: require_once(/Users/kristiannissen/Documents/php/simpletest/arguments.php): failed to open stream: No such file or directory in /Users/kristiannissen/Documents/php/simpletest/reporter.php on line 13

Fatal error: require_once(): Failed opening required '/Users/kristiannissen/Documents/php/simpletest/arguments.php' (include_path='.:/usr/lib/php:/Users/kristiannissen/Documents/php') in /Users/kristiannissen/Documents/php/simpletest/reporter.php on line 13
3
  • Anyone ever figure out how to solve this? SimpleTest doesn't appear to work without the arguments.php file. I downloaded and substituted in the one from the PHP4 version of SimpleTest, but it is not a compatible replacement for the missing file. Commented Feb 17, 2011 at 21:03
  • Success. SimpleTest 1.0.1 works with CakePHP 1.3.7. Commented Feb 17, 2011 at 21:48
  • I downloaded version 1.0.1 and it work OK, it contains a lot of deprecation warnings but you can use it. Commented Feb 18, 2011 at 12:20

2 Answers 2

1

personally your view pages are the first executed, such as index.php and view pages should always be in the root of your html.

so within index.php you can do:

define("BASE_PATH",str_replace("\\","/",dirname(__FILE__)));

so now BASE_PATH would be equal to: /Users/kristiannissen/Documents/php/simpletest

So if you want to phpdirectory in your include path you should use dirname() to go UP a directory:

//Get an array of your include paths
$include_parts = explode(PATH_SEPARATOR,get_include_path());

//Extend the paths
$include_parts[] = dirname(dirname(BASE_PATH)); //this is ../../

//recompile the paths and set them
set_include_path(implode(PATH_SEPARATOR,$include_parts));

this is the safe way to accomplish what your trying to do.

Sign up to request clarification or add additional context in comments.

1 Comment

After having spent more time on this I found out that it wasn't my include path that was the problem but simpletest. It looks as if arguments.php is missing from the folder, I tried to download it again but it's not there.
1

There is an alpha2-release on sourceforge that has the arguments.php-require commented out. I guess it isn't needed anymore.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.