Phpstorm laravel Unit Test Configuration

Source: Internet
Author: User
Tags autoload

Laravel Integrated Unit Test Tool phpunit can be used in the root directory of the project, the command is: Phpunti./tests/unit test file name. Using PHPUnit in Phpstorm requires some configuration, specifying composer autoload.php. The following are the specific practices:

1. Select file->setting->languages&framework->php->phpunit;

2, in PHPUnit Liberay select Use Composer autoloader;

3, in the box below to fill in the project directory/vendor/autoload.php;

The configuration is completed after saving.

After the configuration is complete, right-click the file you want to unit test,

For example, the unit test file can be written like this:

<?PHP Uselaravel\lumen\testing\databasetransactions;classExampletestextendstestcase{/** * A Basic Test example. * * @return void*/     Public functiontestexample () {$this->get ('/'); $this-Assertequals ($this->app->version (),$this->response->getcontent ()); }     Public functionTestinsert () {$this->get ('/user/getlist '); $data=$this->response->getcontent (); Var_dump($data); $this->asserttrue (Strpos($data, ' {')!==false); }}

Phpstorm laravel Unit Test Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.