テストを実行
$ php utils-test.php
1..2
PHPFatal error: Call to undefined function to_alphanum()
in /Users/tanakahisateru/Desktop/limetest/utils-test.php on
line 8
コマンドラインからutils-test.phpスクリプトを実行すると、失敗。
to_alphnumメソッドが実装されていないことがわかる。
PHPでは「関数がない」とか「シンタックスエラーがある」
という、コンパイラを通る言語なら普通起こらないような
ミスが起こる。
すべてのソースをいちどrequireして関数コールを試しておく。
これコンパイルエラーのチェックと同じぐらい大事なこと。
テストの実行
$ php utils-test.php
1..1
notok 1
# Failed test (./utils-test.php at line 10)
# got: '06−6543−9876'
# expected: '06-6543-9876'
# Looks like you failed 1 tests of 1.
もちろん失敗するよね。
テストの実行
$ php utils-test.php
1..1
ok1
not ok 2
# Failed test (./utils-test.php at line 13)
# got: 'tanakahisateru@gmail.com'
# expected: 'tanakahisateru@gmail.com'
# Looks like you planned 1 tests but ran 1 extra.
# Looks like you failed 1 tests of 2.
もちろん新しく追加したテストは失敗する。
おっとこれは!!
$ php utils-test.php
notok 1
# Failed test (./utils-test.php at line 9)
# got: '06−6543−9876'
# expected: '06-6543-9876'
not ok 2
# Failed test (./utils-test.php at line 13)
# got: 'tanakahisateru@gmail.com'
# expected: 'tanakahisateru@gmail.com'
1..2
# Looks like you failed 2 tests of 2.
実行した様子
/Users/tanakahisateru/Sites/pinoco/test/unit/test_vars.php:
# Pinoco_Vars Test
#toArray test
# import test
1..47
# Looks like everything went fine.
/Users/tanakahisateru/Sites/pinoco/test/unit/test_list.php:
# Pinoco_List Test
# push/pop
# shift/unshift
1..60
# Looks like everything went fine.
/Users/tanakahisateru/Sites/pinoco/test/unit/test_lazy.php:
# Pinoco_LazyValueProxy Test
(略)