Home Backend Development PHP Tutorial Windows下安装PHP单元测试环境PHPUnit图文教程_php技巧

Windows下安装PHP单元测试环境PHPUnit图文教程_php技巧

May 16, 2016 pm 08:34 PM
php phpunit windows

1、按照常规下载 php 的zip包和配置好 php.ini,这里的例子使用的是 E:\php

2、把你的 php 目录加入系统环境变量 path 中

3、开始 运行 输入 cmd,然后切换到你的 php 目录,我当前的就是 E:\php

4、输入 go-pear.bat

首先脚本会询问是把 pear 安装为系统范围的还是本地拷贝,这里我们默认选择系统,直接回车即可

5、这时显示当前的路径配置,并询问你是否修改,我们保持默认依然回车即可,回车后脚本就会开始自动安装 pear 库了

6、安装的时候脚本会提示你设定 php.ini 的里面 include_path,我们按照要求在 php.ini 里面设置好,设置好后回车即可

7、最后脚本会提醒你导入 pear 的系统变量注册文件,这个文件就在你的 php 目录中

8、输入回车,pear 的安装就完成了, 测试 pear 是否装好,可以直接在命令行输入 pear,如果你看到下列的输出,那就是 ok 了

9、开始安装 PHPUnit,首先升级 pear,输入命令

<div class="codetitle">
<span><a style="CURSOR: pointer" data="36582" class="copybut" id="copybut36582" onclick="doCopy('code36582')"><u>复制代码</u></a></span> 代码如下:</div><div class="codebody" id="code36582">
<br>pear upgrade pear<br>
</div>
Copy after login

10、再依次输入下列命令添加 pear 的频道, 添加的时候可能会因为网络问题可能会提示失败,多试几次即可

<div class="codetitle">
<span><a style="CURSOR: pointer" data="28296" class="copybut" id="copybut28296" onclick="doCopy('code28296')"><u>复制代码</u></a></span> 代码如下:</div><div class="codebody" id="code28296">
<br>pear channel-discover components.ez.no<br>pear channel-discover pear.phpunit.de<br>pear channel-discover pear.symfony-project.com<br>
</div>
Copy after login

小提示:

添加时如果出现下列错误提示,请在 php.ini 里面开启 php_openssl.dll 这个扩展

Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?

11、输入下列命令开始安装 PHPUnit,同样,安装的时候因为网络问题可能会提示失败,多试几次即可

<div class="codetitle">
<span><a style="CURSOR: pointer" data="6270" class="copybut" id="copybut6270" onclick="doCopy('code6270')"><u>复制代码</u></a></span> 代码如下:</div><div class="codebody" id="code6270">
<br>pear install --alldeps --force pear.phpunit.de/PHPUnit<br>pear install pear.phpunit.de/DbUnit<br>
</div>
Copy after login

12、待命令运行完毕后,PHPUnit 就安装好了,我们可以通过输入 PHPUnit 来测试是否安装成功

如果你输入 php 出现上图的显示,那么你的 PHPUnit 就安装完成了。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1238
24
PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Choosing Between PHP and Python: A Guide Choosing Between PHP and Python: A Guide Apr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Python: A Deep Dive into Their History PHP and Python: A Deep Dive into Their History Apr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP's Impact: Web Development and Beyond PHP's Impact: Web Development and Beyond Apr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP vs. Python: Use Cases and Applications PHP vs. Python: Use Cases and Applications Apr 17, 2025 am 12:23 AM

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

PHP: An Introduction to the Server-Side Scripting Language PHP: An Introduction to the Server-Side Scripting Language Apr 16, 2025 am 12:18 AM

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

The Continued Use of PHP: Reasons for Its Endurance The Continued Use of PHP: Reasons for Its Endurance Apr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! Apr 17, 2025 pm 09:54 PM

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

See all articles