MAMPでPHPUnitが動かなくなったのでしらべてみた。

備忘録がてらメモっておきます。
まさにこの症状がでてました。

 


PHP Fatal error: Class 'File_Iterator' not found in /usr/share/php/File/Iterator/Factory.php on line 105

http://www.mediawiki.org/wiki/Manual:PHP_unit_testing

Edit /usr/share/pear/File/Iterator/Factory.php and on line 44 add require_once ‘File/Iterator.php’;.
と書かれていたので、/Applications/MAMP/bin/php5.3/share/pear/File/Iterator.phpを直したら治りました。

[読書] 俺のコードのどこが悪い

本屋で見かけて、衝動買いしました。
コードレビュー時にどのように説明するか?とか見るべきポイント等を知りたいなと思っていたので、ついつい…..

積ん読にならないように早めに読んでしまいたいと思います。

OSX MAMPにStagehand_TestRunner のインストール

環境
OSX Lion 10.7.2
MAMP 1.9.2

$ /Applications/MAMP/bin/php5.3/bin/pear channel-discover pear.piece-framework.com

nekoget-no-MacBook-Pro:php5.3 neko$ /Applications/MAMP/bin/php5.3/bin/pear channel-discover pear.piece-framework.com
Adding Channel "pear.piece-framework.com" succeeded
Discovery of channel "pear.piece-framework.com" succeeded

$ /Applications/MAMP/bin/php5.3/bin/pear install piece/stagehand_testrunner

nekoget-no-MacBook-Pro:php5.3 neko$ /Applications/MAMP/bin/php5.3/bin/pear install piece/stagehand_testrunner
WARNING: "pear/Console_Color" is deprecated in favor of "pear/Console_Color2"
Did not download optional dependencies: pear/Console_Color, use --alldeps to download automatically
piece/Stagehand_TestRunner can optionally use package "pear/Console_Color" (version >= 1.0.2)
downloading Stagehand_TestRunner-2.20.0.tgz ...
Starting to download Stagehand_TestRunner-2.20.0.tgz (46,892 bytes)
.............done: 46,892 bytes
downloading Stagehand_AlterationMonitor-1.1.0.tgz ...
Starting to download Stagehand_AlterationMonitor-1.1.0.tgz (3,817 bytes)
...done: 3,817 bytes
downloading Stagehand_Autoload-1.1.0.tgz ...
Starting to download Stagehand_Autoload-1.1.0.tgz (4,530 bytes)
...done: 4,530 bytes
downloading Stagehand_CLIController-1.0.1.tgz ...
Starting to download Stagehand_CLIController-1.0.1.tgz (3,500 bytes)
...done: 3,500 bytes
downloading Stagehand_DirectoryScanner-1.1.0.tgz ...
Starting to download Stagehand_DirectoryScanner-1.1.0.tgz (3,290 bytes)
...done: 3,290 bytes
downloading Stagehand_LegacyError-1.0.2.tgz ...
Starting to download Stagehand_LegacyError-1.0.2.tgz (4,582 bytes)
...done: 4,582 bytes
downloading Stagehand_AccessControl-1.0.0.tgz ...
Starting to download Stagehand_AccessControl-1.0.0.tgz (3,975 bytes)
...done: 3,975 bytes
install ok: channel://pear.piece-framework.com/Stagehand_Autoload-1.1.0
install ok: channel://pear.piece-framework.com/Stagehand_LegacyError-1.0.2
install ok: channel://pear.piece-framework.com/Stagehand_CLIController-1.0.1
install ok: channel://pear.piece-framework.com/Stagehand_AccessControl-1.0.0
install ok: channel://pear.piece-framework.com/Stagehand_DirectoryScanner-1.1.0
install ok: channel://pear.piece-framework.com/Stagehand_AlterationMonitor-1.1.0
install ok: channel://pear.piece-framework.com/Stagehand_TestRunner-2.20.0

$ /Applications/MAMP/bin/php5.3/bin/pear install Console_Color

nekoget-no-MacBook-Pro:php5.3 neko$ /Applications/MAMP/bin/php5.3/bin/pear install Console_Color
WARNING: "pear/Console_Color" is deprecated in favor of "pear/Console_Color2"
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading Console_Color-1.0.3.tgz ...
Starting to download Console_Color-1.0.3.tgz (4,933 bytes)
.....done: 4,933 bytes
install ok: channel://pear.php.net/Console_Color-1.0.3

結局uninstallしました… orz

OSX Lion XAMPP環境にPHPUnitをインストールする

備忘録…
XAMPPはめんどくさい…..
phpunitのパスどこだろう?
後でもう一度やりなおそうorz

$ cd /Applications/xampp/xamppfiles/lib/php/pear

sudo php pearcmd.php channel-update pear.php.net

$ sudo php pearcmd.php channel-update pear.php.net
No log handling enabled - using stderr logging
Created directory: /var/db/net-snmp
Created directory: /var/db/net-snmp/mib_indexes

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /Applications/XAMPP/xamppfiles/lib/php/pear/PEAR/Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /Applications/XAMPP/xamppfiles/lib/php/pear/PEAR/Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /Applications/XAMPP/xamppfiles/lib/php/pear/PEAR/Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /Applications/XAMPP/xamppfiles/lib/php/pear/PEAR/Registry.php on line 1012
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded

sudo php pearcmd.php install PEAR

$ sudo php pearcmd.php install PEAR
downloading PEAR-1.9.4.tgz ...
Starting to download PEAR-1.9.4.tgz (296,332 bytes)
.............................................................done: 296,332 bytes
downloading Archive_Tar-1.3.8.tgz ...
Starting to download Archive_Tar-1.3.8.tgz (17,995 bytes)
...done: 17,995 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 Console_Getopt-1.3.1.tgz ...
Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes)
...done: 4,471 bytes
downloading XML_Util-1.2.1.tgz ...
Starting to download XML_Util-1.2.1.tgz (17,729 bytes)
...done: 17,729 bytes
install ok: channel://pear.php.net/Archive_Tar-1.3.8
install ok: channel://pear.php.net/Structures_Graph-1.0.4
install ok: channel://pear.php.net/Console_Getopt-1.3.1
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.9.4
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"

sudo php pearcmd.php config-set auto_discover 1
config-set succeeded

$ sudo php pearcmd.php config-set auto_discover 1
config-set succeeded

sudo php pearcmd.php install phpunit

$ sudo php pearcmd.php install phpunit

WARNING: "pear/PHPUnit" is deprecated in favor of "channel://pear.phpunit.de/PHPUnit"
Did not download dependencies: pear/PHP_Compat, use --alldeps or --onlyreqdeps to download automatically
pear/PHPUnit can optionally use package "pear/PHP_Compat"
downloading PHPUnit-1.3.2.tgz ...
Starting to download PHPUnit-1.3.2.tgz (20,913 bytes)
........done: 20,913 bytes
install ok: channel://pear.php.net/PHPUnit-1.3.2
$ php pearcmd.php list
Installed packages, channel pear.php.net:
=========================================
Package          Version State
Archive_Tar      1.3.8   stable
Console_Getopt   1.3.1   stable
Log              1.12.7  stable
PEAR             1.9.4   stable
PHPUnit          1.3.2   stable
Structures_Graph 1.0.4   stable
XML_Util         1.2.1   stable

なんだかPEARが古い…. 順番間違ってるけど、upgrade
sudo /Applications/XAMPP/xamppfiles/bin/pear upgrade PEAR

$ sudo /Applications/XAMPP/xamppfiles/bin/pear upgrade PEAR
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading PEAR-1.9.4.tgz ...
Starting to download PEAR-1.9.4.tgz (296,332 bytes)
.............................................................done: 296,332 bytes
downloading Archive_Tar-1.3.8.tgz ...
Starting to download Archive_Tar-1.3.8.tgz (17,995 bytes)
...done: 17,995 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 Console_Getopt-1.3.1.tgz ...
Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes)
...done: 4,471 bytes
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.8
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.4
upgrade ok: channel://pear.php.net/Console_Getopt-1.3.1
upgrade ok: channel://pear.php.net/PEAR-1.9.4
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"