Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php artisan command to make tests file inside a particular folder

Currently I have started learning about Unit Testing in Laravel 5.6. By default my laravel project has a 'tests' directory inside which I have 2 more directories namely, 'Features' and 'Unit'. Each of these directories contain a 'ExampleTest.php'

./tests/Features/ExampleTest.php
./tests/Unit/ExampleTest.php

Whenever I create new test file using command

php artisan make:test BasicTest

It always creates the test file inside the 'Features' directory by default, where as I want the file to be created under the 'tests' directory.

Is there a command using which I can specify the path fro creation of the test file. Something like this

php artisan make:test BasicTest --path="tests"

I have already tried the above path command but it is not a valid command.

Do I need to change some code in my phpunit.xml file?

like image 534
Keith M Avatar asked Jan 28 '23 00:01

Keith M


1 Answers

php artisan make:test  Web/StatementPolicies/StatementPolicyListTest

It will by default create a file namely StatementPolicyListTest under StatementPolicies(if not exist it will create a new folder of this name) folder under tests/Feature/Web

like image 70
Tanusree Halder Avatar answered Apr 28 '23 17:04

Tanusree Halder