如何使用 MAMP 在 mac 上安装 phpunit 3.5
我正在尝试使用 MAMP 在 Mac OS X 上安装 PHPUnit 3.5。我确实通过 MAMP 的 PEAR 安装了 PHPUnit 3.5。这一切都是正确的,phpunit 位于 /Applications/MAMP/bin/php5.3/lib/php/PEAR/PHPUnit。可执行文件位于/Applications/MAMP/bin/php5.3/bin/。
但是,当我想执行 phpunit 时,它不会执行任何操作,即使我在 MAMP php 的 bin 文件夹中执行它也是如此。
有人可以帮我解决这个问题吗?
更新
which phpunit: /Applications/MAMP/bin/php5.3/bin//phpunit
which pear: /Applications/MAMP/bin/php5.3/bin//pear
梨列表 已安装的软件包,通道 pear.php.net:
软件包版本状态
Archive_Tar 1.3.7 stable
Console_Getopt 1.2.3 stable
PEAR 1.9.1 stable
Structures_Graph 1.0.3 stable
XML_Util 1.2.1 stable
phpunit 内容
#!/Applications/MAMP/bin/php5.3/bin/php
<?php
require_once 'PHP/CodeCoverage/Filter.php';
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'PHPUNIT');
if (extension_loaded('xdebug')) {
xdebug_disable();
}
if (strpos('/Applications/MAMP/bin/php5.3/bin/php', '@php_bin') === 0) {
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
}
require_once 'PHPUnit/Autoload.php';
define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
PHPUnit_TextUI_Command::main();
I'm trying to install PHPUnit 3.5 on Mac OS X with MAMP. I did install PHPUnit 3.5 via PEAR of MAMP. This is all correctly and phpunit is located /Applications/MAMP/bin/php5.3/lib/php/PEAR/PHPUnit. The executable is located in /Applications/MAMP/bin/php5.3/bin/.
But when I want to execute phpunit it doesn't do anything, even when I do execute it in the bin folder of MAMP php.
Can somebody help me with this?
Update
which phpunit: /Applications/MAMP/bin/php5.3/bin//phpunit
which pear: /Applications/MAMP/bin/php5.3/bin//pear
pear list
Installed packages, channel pear.php.net:
Package Version State
Archive_Tar 1.3.7 stable
Console_Getopt 1.2.3 stable
PEAR 1.9.1 stable
Structures_Graph 1.0.3 stable
XML_Util 1.2.1 stable
Content of phpunit
#!/Applications/MAMP/bin/php5.3/bin/php
<?php
require_once 'PHP/CodeCoverage/Filter.php';
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'PHPUNIT');
if (extension_loaded('xdebug')) {
xdebug_disable();
}
if (strpos('/Applications/MAMP/bin/php5.3/bin/php', '@php_bin') === 0) {
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
}
require_once 'PHPUnit/Autoload.php';
define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
PHPUnit_TextUI_Command::main();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
which phpunit
和which pear
和pear list
的输出是什么?您还使用
--alldeps
选项安装 phpunit 吗?What is the output of
which phpunit
andwhich pear
andpear list
?Also did you install phpunit with the
--alldeps
option?我在 Mac 上成功安装了带有 XAMPP 的 PHPUnit,但是花了我一些时间。
技巧之一是编辑 phpunit 脚本,将其配置为使用 XAMPP(或 MAMP)PHP 可执行文件,而不是 Mac 上的默认可执行文件。
I succeeded in installing PHPUnit with XAMPP on Mac, but it took me some time.
One of the trick was to edit the phpunit script to configure it to use XAMPP (or MAMP) PHP executable, and not the default one on Mac.