Solutions to problems with phpunit testing

Source: Internet
Author: User
Tags derick zend
today to build the LAMP development environment of this machine, because the system comes with PHP version is 5.5.14, but the development to use is PHP 5.6 above, so installed PHP 5.6.7. This led to the existence of two versions of PHP in the system.

Normal development is not a problem, but if the use of Phpunit,phpunit will call the system comes with PHP 5.5.14来 execution. The PHP extensions I installed (such as Memcache,redis, etc.) are installed on the version of PHP 5.6.7.

When you use phpunit to do unit tests, you are prompted to expand without installation. (for example, memcache function not found).

PHPUnit called PHP is /usr/bin/php, so the location of Php point to the current version of the php5.6.7 can solve the problem.

Here's how to fix it:

1. View the currently used PHP version

php-vphp 5.6.7 (CLI) (Built:apr 23:10:47) (DEBUG) Copyright (c) 1997-2015 the PHP groupzend Engine v2.6.0, Copyri Ght (c) 1998-2015 Zend Technologies with    Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans

2. View the version of/usr/bin/php

/usr/bin/php-vphp 5.5.14 (CLI) (built:sep  9 19:09:25) Copyright (c) 1997-2014 the PHP groupzend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

3. Back up the/usr/bin/php version and restore it when there is a problem

sudo cp/usr/bin/php/usr/bin/php55

4. Remove the/usr/bin/php

sudo rm/usr/bin/php

5. Create a PHP/usr/bin/php Softlink point to php5.6.7

sudo ln-s/usr/local/cellar/php56/5.6.7/bin/php/usr/bin/php

6. Check if/usr/bin/php has been updated

/usr/bin/php-vphp 5.6.7 (CLI) (Built:apr 23:10:47) (DEBUG) Copyright (c) 1997-2015 the PHP groupzend Engine v2.6. 0, Copyright (c) 1998-2015 Zend Technologies with    Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans

After execution, the problem is resolved.

This article explains the solution to the problem of phpunit test, more relevant content please pay attention to the PHP Chinese web.

Related recommendations:

PHP str_replace to replace the specified number of times method explanation

About Header,headers_sent,headers_list,header_remove Usage Instructions

Query MySQL return field by PDO the integer type becomes a string-based workaround

Related Article

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.