سلام و خسته نباشید، هر کاری میکنم class not found میگیرم.
namespace app\\models; class User { private string $name; public function getName(): string{ return $this->name; } public function setName(string $name): void{ $this->name = $name; } }
use PHPUnit\\Framework\\TestCase; use app\\models\\User; class UserTest extends TestCase { function testUserFirstName() { $user = new User(); $user->setName('ehsan'); self::assertEquals('ehsan', $user->getName()); } }
{"name": "ehsan/phpunit_test","autoload": {"psr-4": {"app\\\\" : "app"}},"authors": [{"name": "ehsan","email": "ehsan@example.com"}],"require-dev": {"phpunit/phpunit": "9"} }
Directory structure:
phpunit.xml: