1. Home
  2. Docs
  3. laravel
  4. “php artisan make:&...
  5. artisan make:test

artisan make:test

PURPOSE

  • testing is done through the PHPUnit package and is run by executing “composer test. Testing should check for correct results and correct triggering of exceptions.
  • Unit tests are tests that focus on a very small, isolated portion of your code. In fact, most unit tests probably focus on a single method
  • Feature tests may test a larger portion of your code, including how several objects interact with each other or even a full HTTP request to a JSON endpoint.

USAGE

> php artisan make:test WidgetTest

 Description:
   Create a new test class
 

 Usage:
   make:test [options] [--] <name>
 

 Arguments:
   name                  The name of the class
 

 Options:
       --unit            Create a unit test
   -h, --help            Display this help message
   -q, --quiet           Do not output any message
   -V, --version         Display this application version
       --ansi            Force ANSI output
       --no-ansi         Disable ANSI output
   -n, --no-interaction  Do not ask any interactive question
       --env[=ENV]       The environment the command should run under
   -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 

PARAMETERS

--unit

Create a unit (or, otherwise, feature) test.

OUTPUT

tests\Unit\CalculationUnitTest.php
tests\Feature\UserCreationFeatureTest.php

Reference: https://laravel.com/docs/6.x/testing