MacBook HDD換装後

MacBookのHDDを320GBに換装後、移せるものは移しつつ、
データ以外は再構築中。。。

とりあえず、現状のMacBookにインストールしたものを。

[開発ツール系]

[サービス系]

あとは-Adobe CS3 MASTER COLLECTIONを入れたらなんとか形になりそうや。

>自分
MacPortsからインストールしたものはすべて/opt配下に入ることをお忘れなく

EthnaでSimpleTest(4)

ちゅーか、一週間ぐらいSimpleTestで悩んでる気がする。。。
ほんまにここまで悩むようなもんやねんやろか。。。

#自分の実力が足らんだけかと思ったりもするねんけど。。。。

とりあえずWebTestCaseを使って、
Indexページのテストロジックを作ってみた。

今作ってるのは携帯向けにRSSを取得して表示するもの。

デフォルトyahooのトップページを取得したりするもので、
まずはその部分のテストを実装してみたので、晒します。

もし、そんな風に実装するもんではないよというように
親切に教えてくださる方がいれば是非コメントください。。。

addHeader('User-Agent:KDDI-SA31 UP.Browser/6.2.0.6.3.129 (GUI) MMP/2.0');
$this->get('http://localhost/index.php');

// RSS 取得
$rss =& new XML_RSS('http://dailynews.yahoo.co.jp/fc/rss.xml');
// RSS パース
$rss->parse();

$i = 0;
foreach ($rss->getItems() as $value) {
if($value['title'] != ""){
$title[$i] = mb_convert_encoding($value['title'], "SJIS", "UTF-8");
$i++;
}
}
for($j=0; $j < $i; $j++){
$this->assertLink($title[$j]);
}
}
}

$test = new BrowserTest();
$test->run(new HtmlReporter('SJIS'));

?>

そうすると、大量のE_NOTICEのExceptionが!

Exception: testViewController -> Unexpected PHP error [Only variable references should be returned by reference] severity [E_NOTICE] in [/usr/local/lib/php/simpletest/user_agent.php] line [444]
Exception: testViewController -> Unexpected PHP error [Only variable references should be returned by reference] severity [E_NOTICE] in [/usr/local/lib/php/simpletest/http.php] line [309]
Exception: testViewController -> Unexpected PHP error [Only variable references should be returned by reference] severity [E_NOTICE] in [/usr/local/lib/php/simpletest/http.php] line [520]
Exception: testViewController -> Unexpected PHP error [Only variable references should be returned by reference] severity [E_NOTICE] in [/usr/local/lib/php/simpletest/page.php] line [58]
Exception: testViewController -> Unexpected PHP error [Only variable references should be returned by reference] severity [E_NOTICE] in [/usr/local/lib/php/simpletest/page.php] line [69]
:
(以下略)
:
1/1 test cases complete: 8 passes, 0 fails and 17 exceptions.

テスト自体はpassしてるみたいなんやけど、
SimpleTest側でExceptionが出てるみたい。。。

WEBやSimpleTestのソースを調べると参照渡ししているのに
実体を返していたり、その逆だったりするとでるみたい。。。

まともに対処しようとするとSimpleTestの該当箇所、結構変えなきゃいけなさそうなので
暫定対処でerror_reporting()の箇所を下記のように変更して逃げてみた。。。

error_reporting(E_ALL & ~E_NOTICE)

結構消えて一個だけになった!

Exception: testViewController -> Unexpected PHP error [Only variable references should be returned by reference] severity [E_NOTICE] in [/usr/local/lib/php/simpletest/user_agent.php] line [462]

1/1 test cases complete: 8 passes, 0 fails and 1 exceptions.

該当箇所をみると、やっぱり、参照系のよう。

function &_createRoute($url) {
if ($this->_proxy) {
return new SimpleProxyRoute(
$url,
$this->_proxy,
$this->_proxy_username,
$this->_proxy_password);
}
return new SimpleRoute($url);
}

なので、関数名のところから「&」をとって対処

function _createRoute($url) {
if ($this->_proxy) {
return new SimpleProxyRoute(
$url,
$this->_proxy,
$this->_proxy_username,
$this->_proxy_password);
}
return new SimpleRoute($url);
}

試してみると。。。。

1/1 test cases complete: 8 passes, 0 fails and 0 exceptions.

緑色〜〜〜〜!!!!!

でも、まだまだでてくるんやろな。。。

あぁ、わかった。。。

これって関数ActionClassの内部のローカル変数とかいじってテストするもんじゃないねんや。。。

ActionFormに渡された値によって、
最終的なリターンで返される値とかをチェックするもんの気がしてきた。。。

あとは見た目のチェックも含めてWebTestCaseで補完するのかと思うと納得できたり。。。

ちょっとこの方向で検討してみよう。