How proper unit test |
Hello
So, I have problem with testing. Firstly - yes I read Testing Section in CI4 Docs When I run simply "phpunit" in CI4 directory I have error: Class `CodeIgniter\Test\CIUnitTestCase` not found in (...)\tests\_support\CIUnitTestCase.php on line 5 What's wrong? Composer update run with no-complications.
(10-03-2018, 01:46 AM)Przem4S Wrote: Hello All works fine for me. composer create-project codeigniter4/framework:dev-develop mysuperapp cd mysuperapp && composer install ln -s ./vendor/bin/phpunit ./phpunit Create the file tests/TestFoo.php: PHP Code: <?php Execute the test with this command: Code: ./phpunit tests/TestFoo.php --filter bar
@unodepiera
Your're running OS X, I'm Windows user - ln is not windows command, /vendor/bin/phpunit is not executable for windows. But you navigate me to phpunit.bat and this resolve problem - thank you. Proper command to run test for Windows: PHP Code: {framework_dir}\vendor\phpunit\phpunit.bat tests/TestFoo.php --filter bar I hope, that help other people with that same problem. Thread to close
I have another question about unit tests, on my computer many test fails:
Directory example, problem with path: Word-wrapping example: I have many errors like that, any paths, any wordwrapping. How solve this?
yes - the most devs are unix users so the line ending ist \n
you use windows, so your line ending is \r\n if you want to fix them, you need a unix system that execute the tests - or ignore them |
Welcome Guest, Not a member yet? Register Sign In |