
Originally Posted by
nacho
Wouldn't be easier to use a Register/ObjectFactory and store the registered objects under a common array key that would function as a fake namespace?
No, because that isn't the problem. Example:
index.php
PHP Code:
require('foo.php');
require('bar.php');
foo.php
PHP Code:
class Klass {
function hi() {
echo 'hi';
}
}
bar.php
PHP Code:
class Klass {
function bye() {
echo 'bye';
}
}
That will cause a fatal when you get to the second "class Klass" due to a "redeclared class". You need to get in before the require for it to work.
I wonder if anything in the Simple Test mock library could handle this?
Douglas
Bookmarks