Installation of Wamp PHP Unit Test tool PHPUnit under Windows

Source: Internet
Author: User

PHPUnit Download website http://www.phpunit.cn/

I. Installation PHPUnit

1. Select version

I'm using a PHP version of 5.6.25 so I chose PHPUnit 5.7.

2. Installation process

  1. Create a directory for the PHP binary executable file, for exampleC:\bin

  2. will be ;C:\bin appended to the PATH environment variable " directory of PHP; E:\wamp64\bin\php\php5.6.25 is also attached PATH to the environment variable "

  3. Download Phpunit.phar and save the file toC:\bin\phpunit.phar

  4. Open cmd command line

  5. Create an outsourced batch processing script (automatically generated in the last Bin directory C:\bin\phpunit.cmd 文件 ):

    c:\users\username> cd c:\binc:\bin"%~dp0phpunit.phar" %* >  Phpunit.cmdc:\bin> Exit
  6. " Note that the download is generally Phpunitx-y.phar, with the version number, so to remove the version number modified file named Phpunitx.phar"
  7. Open a new CMD command-line window and confirm that you can execute PHPUnit under any path:

    C:\bin>phpunit--5.7.  by Sebastian Bergmann and contributors.
    two. Test with PHPUnit
    在C:\bin 目录下创建文件StackTest.php
    <?PHP Usephpunit\framework\testcase; classStacktestextendsTestCase { Public functionTestpushandpop () {$stack= []; $this->assertequals (0,Count($stack)); Array_push($stack, ' foo '); $this->assertequals (' foo '),$stack[Count($stack)-1]); $this->assertequals (1,Count($stack)); $this->assertequals (' foo '),Array_pop($stack)); $this->assertequals (0,Count($stack)); }    }    ?>
    To test
    C:\bin>phpunit stacktest.phpphpunit 5.7.19 by Sebastian Bergmann and contributors                                                                   . 1/1 (100%) time:543 MS, Memory:13.00mbok (1 Test, 5 assertions)

      

Installation of Wamp PHP Unit Test tool phpunit under Windows

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.