atoum / atoum

The modern, simple and intuitive PHP unit testing framework.
http://atoum.org
Other
1.44k stars 147 forks source link

Unable to use an abstract class without require #54

Closed ludofleury closed 12 years ago

ludofleury commented 12 years ago

As mentioned in the wiki here, I wanted to change the default namespace with an abstract class. I use an autoloader and don't want to include atoum in all my test files. Yet atoum is unable to launch test because he can't find the abstract class extended by my final.

I didn't take too much time to make some reverse, yet it appear that the atoum process do not rely on the autoloader at start.

mageekguy commented 12 years ago

I am not sure to fully understand your problem, but perhaps that using a bootstrap file via --bootstrap-file/-bf is a solution and initialize your autoloader in it is a solution.

ludofleury commented 12 years ago

Ok, here the situation report:

I always use these commands to run my test

$ php vendor/mageekguy/atoum/bin/atoum -c .atoum.php -f path/to/my/final/test/class
$ php vendor/mageekguy/atoum/bin/atoum -c .atoum.php -f path/to/my/tests

Then I've got a fatal error triggered by atoum which is unable to find my abstract class. If I remove the inheritance and simply extends atoum/test in my final test class, everything is fine.

After hardcore oldschool debugging with my dirty hand (var_dump & die), I know that my config file named ".atoum.php" is loaded. I also know that my "bootstrap file" required in this config file ".atoum.php" is loaded.

Moreover, I'm able to trigger an error from the bootstrap file (tried to instantiate my abstract, and PHP trigger a regular error). So the strange thing is : the abstract class seems loaded in my bootstrap file, yet atoum can't find/use/load it.

I tried an "hardcore" require in my config file or my bootstrap file with the absolute path of the file, and it didn't seems to change anything for atoum.

The use case is pretty simple and you can reproduce it with Boomgo repository Just take a test file and extends an abstract, run the test, it fails. Maybe I'm missing something ?