DEV Community

Discussion on: php - How to fix "Class '' not found" error

Collapse
 
dechamp profile image
DeChamp

Ok so here are some things you need to check. First you see that it's looking for the PHPUnit class. Which is provided via composer. Now if you look at the composer.json, you'll see PHPUnit is provided via the dev dependencies. How if you do a composer installl --no-dev, the the package would not be available. Another issue, is you need to be running php_osmessa\tests\TileTest.php needs to be ran via phpunit itself. If you try running this by itself, it'll fail. Have you checked your vendor folder for the phpunit files?

Collapse
 
martial2017 profile image
martial2017

ok! thank you for your answer. First I use "composer install" for downloading all dependencies so in phpunit folder located in vendor I have 7 folder named "php-code-coverage", "php-file-iterator", php-test-template", "php-timer","php-token-stream", "phpunit", "phpunit-mock-objects".
I think all files is there.
the purpose of my work is to use these classes for loading map tiles from php application so need to run it from browser.
But when I run it by php line command php php_osmessa/tests/Tiletest.php

Thread Thread
 
dechamp profile image
DeChamp

So that is what I was saying. Those are actual “test” plans. Not a “try out your functionality”. You should read up on phpunit. Don’t run those files under the test folder with ‘php ...’ but instead run them with ‘phpunit ...’