atoum icon indicating copy to clipboard operation
atoum copied to clipboard

Missing namespace error is unhelpful

Open sirbrillig opened this issue 8 years ago • 2 comments

If the test file does not use a namespace, this error appears in the default reporter:

==> Error UNKNOWN in /Users/payton/Code/…/tests/InitialThing.php on unknown line, generated by unknown file:
Fatal error: Uncaught mageekguy\atoum\exceptions\runtime: Test class 'InitialThing' is not in a namespace which match pattern '#(?:^|\\)tests?\\units?\\#i' in /Users/payton/Code/…/vendor/atoum/atoum/classes/test.php:1531

It seems to me that the error is known, and the file is also known.

Furthermore, since this error is likely for new users of the tool, it would be helpful to include instructions (or a link to documentation) regarding the solution (add a namespace following atoum's guidelines).

sirbrillig avatar Oct 09 '17 23:10 sirbrillig

Would it help with an error message of kind:

Test class 'InitialThing' cannot be executed as a test suite because it is not in the test namespace, which is defined by the pattern '…'

Hywan avatar Oct 10 '17 09:10 Hywan

We may improve the Error UNKNOWN and on unknown line parts.

@Hywan atoum does not have any "suite" word in its vocabulary. Changin this will message the way you propose does not seem correct to me. atoum uses "test classes" and "test methods".

Moreover, the message seems clear: there is something wrong with the namespace. We should add a link to the documentation as @sirbrillig says.

jubianchi avatar Oct 10 '17 10:10 jubianchi