mageekguy/atoum — Issue #42: display proposition of assert when Atoum's exception is raised
Author: vonglasow
Created: 2011-12-20 14:11:13+00:00
State: open

like we have when we try to use wrong parameter in CLI

php mageekguy.atoum.phar --namespace
Error: Argument '--namespace' is unknown, did you mean '--namespaces' ?

We can have a proposition

Error: Assertion 'sting' is unknown, did you mean 'string' ?

See example

avonglasow@dev-alex:~/project/helloworld$ php tests/units/helloWorld.php
> atoum version nightly-844-201112021413 by Frédéric Hardy (phar:///home/avonglasow/project/helloworld/tests/mageekguy.atoum.phar)
> PHP path: /usr/bin/php5
> PHP version:
=> PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun 28 2011 13:13:26)
=> Copyright (c) 1997-2009 The PHP Group
=> Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
=> with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
=> with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
> vendor\project\tests\units\helloWorld...
[E___________________________________________________________][1/1]
=> Test duration: 0.00 second.
=> Memory usage: 0.00 Mb.
> Total test duration: 0.00 second.
> Total test memory usage: 0.00 Mb.
> Running duration: 0.59 second.
Failure (1 test, 1/1 method, 0 failure, 0 error, 1 exception) !
> There is 1 exception:
=> vendor\project\tests\units\helloWorld::testSay():
==> Exception throwed in file /home/avonglasow/project/helloworld/tests/units/helloWorld.php on line 19:
==> exception 'mageekguy\atoum\exceptions\logic\invalidArgument' with message 'Asserter 'mageekguy\atoum\asserters\sting' does not exist' in phar:///home/avonglasow/project/helloworld/tests/mageekguy.atoum.phar/classes/asserter/generator.php:32
==> Stack trace:
==> #0 phar:///home/avonglasow/project/helloworld/tests/mageekguy.atoum.phar/classes/asserter/generator.php(65): mageekguy\atoum\asserter\generator->__get('sting')
==> #1 /home/avonglasow/project/helloworld/tests/units/helloWorld.php(19): mageekguy\atoum\asserter\generator->__call('sting', Array)
==> #2 /home/avonglasow/project/helloworld/tests/units/helloWorld.php(19): mageekguy\atoum\asserter\generator->sting('Hello World!')
==> #3 phar:///home/avonglasow/project/helloworld/tests/mageekguy.atoum.phar/classes/test.php(539): vendor\project\tests\units\helloWorld->testSay()
==> #4 -(1): mageekguy\atoum\test->runTestMethod('testSay')
==> #5 {main}
Error: Assertion 'sting' is unknown, did you mean 'string' ?