Undeclared identifier PHPUnit PHP Test Framework installation method

Source: Internet
Author: User
Tags channel pear download zend pear
Unit testing is the foundation of several modern agile development approaches, making phpunit a key tool for many large PHP projects. This tool can also be used by the xdebug extension to generate code coverage reports, and can be integrated with phing for automated testing, and finally it can be integrated with selenium to complete large-scale automated integration testing.
How do I install phpunit under the Windows platform Lamp environment XAMPP 1.7.3?
First, run CMD as an administrator and add phpunit channels using pear:
D:\xampp\php>pear Channel-discover pear.phpunit.de
Channel "Pear.phpunit.de" is already initialized
Channel added, try to install PHPUnit:
D:\xampp\php>pear Install Phpunit/phpunit
Unknown Remote channel:pear.symfony-project.com
Unknown Remote channel:pear.symfony-project.com
Unknown Remote channel:components.ez.no
Unknown Remote channel:components.ez.no
Phpunit/phpunit requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
Phpunit/phpunit requires package "Channel://pear.symfony-project.com/yaml" (Version >= 1.0.2)
Phpunit/phpunit can optionally use PHP extension "Dbus"
Phpunit/dbunit requires PEAR Installer (version >= 1.9.1), installed version is1.9.0
Phpunit/dbunit requires package "Channel://pear.symfony-project.com/yaml" (Version >= 1.0.2)
Phpunit/file_iterator requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
Phpunit/php_codecoverage requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
Phpunit/php_codecoverage requires package "Channel://components.ez.no/consoletools" (version >= 1.6)
Phpunit/php_codecoverage requires package "Phpunit/file_iterator" (Version >= 1.2.2)
Phpunit/php_codecoverage can optionally use PHP extension "Xdebug" (Version >= 2.0.5)
Phpunit/phpunit_mockobject requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
Phpunit/phpunit_selenium requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
Phpunit/php_tokenstream requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
Phpunit/php_tokenstream requires package "Channel://components.ez.no/consoletools" (version >= 1.6)
No Valid packages found
Install failed
From the hint, you need to install Pear 1.9.1, and the current pear is 1.9.0, then upgrade the Pear version first.
Pear List-upgrades can list the currently available updates,
D:\xampp\php>pear.bat List-upgrades
Warning:channel "Pear.php.net" has updated it protocols, use "Pear channel-update pear.php.net" to
Update
D:\xampp\php>pear channel-update pear.php.net
Updating Channel "Pear.php.net"
Update of Channel "Pear.php.net" succeeded
D:\xampp\php>pear.bat List-upgrades
PEAR. Php.net AVAILABLE Upgrades (STABLE):
=========================================
CHANNEL Package LOCAL REMOTE SIZE
Pear.php.net Archive_tar 1.3.3 (Stable) 1.3.7 (Stable) 17.2kB
Pear.php.net Console_getargs 1.3.4 (Stable) 1.3.5 (Stable) 17.8kB
Pear.php.net Mail 1.1.14 (Stable) 1.2.0 (Stable) 23kB
Pear.php.net mail_mime 1.5.2 (Stable) 1.8.1 (Stable) 31kB
Pear.php.net Mail_mimedecode 1.5.1 (Stable) 1.5.5 (Stable) 11.4kB
Pear.php.net net_smtp 1.3.4 (Stable) 1.4.4 (Stable) 12.1kB
Pear.php.net Net_socket 1.0.9 (Stable) 1.0.10 (Stable) 5.3kB
Pear.php.net Pear 1.9.0 (Stable) 1.9.1 (Stable) 287kB
Pear.php.net structures_graph 1.0.3 (Stable) 1.0.4 (Stable) 30kB
Channel Pear.phpunit.de:No upgrades available
ZEND.GOOGLECODE.COM/SVN AVAILABLE Upgrades (STABLE):
====================================================
CHANNEL Package LOCAL REMOTE SIZE
ZEND.GOOGLECODE.COM/SVN Zend 1.9.6 (Stable) 1.11.1 (Stable)-
Update all available updates:
D:\xampp\php>pear Upgrade-all
Would upgrade Channel://pear.php.net/archive_tar
Would upgrade Channel://pear.php.net/console_getargs
Would upgrade Channel://pear.php.net/mail
Would upgrade Channel://pear.php.net/mail_mime
Would upgrade Channel://pear.php.net/mail_mimedecode
Would upgrade CHANNEL://PEAR.PHP.NET/NET_SMTP
Would upgrade Channel://pear.php.net/net_socket
Would upgrade Channel://pear.php.net/pear
Would upgrade Channel://pear.php.net/structures_graph
Would upgrade Channel://zend.googlecode.com/svn/zend
Did not download optional DEPENDENCIES:PEAR/AUTH_SASL, use--alldeps to download automatically
PEAR/NET_SMTP can optionally use package "PEAR/AUTH_SASL"
Downloading archive_tar-1.3.7.tgz ...
Starting to download archive_tar-1.3.7.tgz (17,610 bytes)
... done:17,610 bytes
Downloading console_getargs-1.3.5.tgz ...
Starting to download console_getargs-1.3.5.tgz (18,207 bytes)
... done:18,207 bytes
Downloading mail-1.2.0.tgz ...
Starting to download mail-1.2.0.tgz (23,214 bytes)
... done:23,214 bytes
Downloading mail_mime-1.8.1.tgz ...
Starting to download mail_mime-1.8.1.tgz (31,530 bytes)
... done:31,530 bytes
Downloading mail_mimedecode-1.5.5.tgz ...
Starting to download mail_mimedecode-1.5.5.tgz (11,554 bytes)
... done:11,554 bytes
Downloading net_smtp-1.4.4.tgz ...
Starting to download net_smtp-1.4.4.tgz (12,264 bytes)
... done:12,264 bytes
Downloading net_socket-1.0.10.tgz ...
Starting to download net_socket-1.0.10.tgz (5,429 bytes)
... done:5,429 bytes
Downloading pear-1.9.1.tgz ...
Starting to download pear-1.9.1.tgz (293,587 bytes)
... done:293,587 bytes
Downloading structures_graph-1.0.4.tgz ...
Starting to download structures_graph-1.0.4.tgz (30,318 bytes)
... done:30,318 bytes
Downloading zend-1.11.1.tgz ...
Starting to download zend-1.11.1.tgz (3,638,888 bytes)
... done:3,638,888 bytes
Upgrade-all ok:channel://pear.php.net/archive_tar-1.3.7
Upgrade-all ok:channel://pear.php.net/console_getargs-1.3.5
Upgrade-all ok:channel://pear.php.net/mail-1.2.0
Upgrade-all ok:channel://pear.php.net/mail_mime-1.8.1
Upgrade-all ok:channel://pear.php.net/net_socket-1.0.10
Upgrade-all ok:channel://pear.php.net/structures_graph-1.0.4
Upgrade-all ok:channel://zend.googlecode.com/svn/zend-1.11.1
Upgrade-all ok:channel://pear.php.net/mail_mimedecode-1.5.5
Upgrade-all ok:channel://pear.php.net/net_smtp-1.4.4
Upgrade-all ok:channel://pear.php.net/pear-1.9.1
Pear:optional feature Webinstaller available (PEAR ' s web-based installer)
Pear:optional feature Gtkinstaller available (PEAR ' s php-gtk-based installer)
Pear:optional feature Gtk2installer available (PEAR ' s php-gtk2-based installer)
Pear:to Install optional features use "PEAR Install Pear/pear#featurename"
After the success of the update, pear is already the 1.9.1 version, now you can safely install PHPUnit:
D:\xampp\php>pear Install Phpunit/phpunit
Unknown Remote channel:pear.symfony-project.com
Unknown Remote channel:pear.symfony-project.com
Unknown Remote channel:components.ez.no
Unknown Remote channel:components.ez.no
Phpunit/phpunit requires package "Channel://pear.symfony-project.com/yaml" (Version >= 1.0.2)
Phpunit/phpunit can optionally use PHP extension "Dbus"
Phpunit/dbunit requires package "Channel://pear.symfony-project.com/yaml" (Version >= 1.0.2)
Phpunit/php_codecoverage requires package "Channel://components.ez.no/consoletools" (version >= 1.6)
Phpunit/php_codecoverage can optionally use PHP extension "Xdebug" (Version >= 2.0.5)
Phpunit/php_tokenstream requires package "Channel://components.ez.no/consoletools" (version >= 1.6)
Downloading file_iterator-1.2.3.tgz ...
Starting to download file_iterator-1.2.3.tgz (3,406 bytes)
..... done:3,406 bytes
Downloading phpunit_mockobject-1.0.3.tgz ...
Starting to download phpunit_mockobject-1.0.3.tgz (17,333 bytes)
... done:17,333 bytes
Downloading phpunit_selenium-1.0.1.tgz ...
Starting to download phpunit_selenium-1.0.1.tgz (15,285 bytes)
... done:15,285 bytes
Install ok:channel://pear.phpunit.de/file_iterator-1.2.3
Install ok:channel://pear.phpunit.de/phpunit_mockobject-1.0.3
Install ok:channel://pear.phpunit.de/phpunit_selenium-1.0.1
In the above information, there is still no successful installation, pear.symfony-project.com and components.ez.no two channels to add:
D:\xampp\php>pear Channel-discover pear.symfony-project.com
Adding Channel "Pear.symfony-project.com" succeeded
Discovery of channel "Pear.symfony-project.com" succeeded
D:\xampp\php>pear Channel-discover components.ez.no
Adding Channel "Components.ez.no" succeeded
Discovery of channel "Components.ez.no" succeeded
Try installing PHPUnit again:
D:\xampp\php>pear Install Phpunit/phpunit
Phpunit/phpunit can optionally use PHP extension "Dbus"
Phpunit/php_codecoverage can optionally use PHP extension "Xdebug" (Version >= 2.0.5)
Downloading phpunit-3.5.5.tgz ...
Starting to download phpunit-3.5.5.tgz (116,148 bytes)
..... done:116,148 bytes--------
Downloading dbunit-1.0.0.tgz ...
Starting to download dbunit-1.0.0.tgz (38,183 bytes)
... done:38,183 bytes
Downloading php_codecoverage-1.0.2.tgz ...
Starting to download php_codecoverage-1.0.2.tgz (109,280 bytes)
... done:109,280 bytes
Downloading yaml-1.0.4.tgz ...
Starting to download yaml-1.0.4.tgz (9,919 bytes)
... done:9,919 bytes
Downloading consoletools-1.6.1.tgz ...
Starting to download consoletools-1.6.1.tgz (869,994 bytes)
... done:869,994 bytes
Downloading php_tokenstream-1.0.1.tgz ...
Starting to download php_tokenstream-1.0.1.tgz (7,250 bytes)
... done:7,250 bytes
Downloading base-1.8.tgz ...
Starting to download base-1.8.tgz (236,357 bytes)
... done:236,357 bytes
Install ok:channel://pear.symfony-project.com/yaml-1.0.4
Install ok:channel://components.ez.no/base-1.8
Install ok:channel://pear.phpunit.de/dbunit-1.0.0
Install ok:channel://components.ez.no/consoletools-1.6.1
Install ok:channel://pear.phpunit.de/php_tokenstream-1.0.1
Install ok:channel://pear.phpunit.de/php_codecoverage-1.0.2
Install ok:channel://pear.phpunit.de/phpunit-3.5.5
PHPUnit installation success!!!

The above describes the undeclared identifier PHPUnit PHP Test framework installation method, including the undeclared identifier aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.