EC-CUBE2.12.0に含まれているUnitTestを実行してみた

EC-CUBE2.12.0に含まれているUnitTestを実行してみた

EC-CUBE2.11系からUnitテストとseleniumのテストが含まれるようになりました
メンテされてないんだろうなーと思っていたのでスルーしていましたが、ふと興味が湧いたので実行してみました

実行環境はMAMP、PHP5.3.6です

実行の準備

PHPUnitのインストール

MAMP2.0.5にPHPUnitを導入する | のぶろぐ

require.phpを修正する

EC-CUBEはpearへのパスを通さないようにしているようで、もう一回設定してあげないとダメっぽい(かなり謎)
~~~
$ vim test/require.php

/** PHPUnit が含まれる pear ライブラリのパス(必ずフルパスで指定!) */
$pear_path = ‘/Applications/MAMP/bin/php/php5.3.6/lib/php’;
require_once(realpath(dirname(__FILE__)) . “/../html/require.php”);
set_include_path(get_include_path() . PATH_SEPARATOR . $pear_path);
~~~

↓のように書いて動かないかなーと試したけどダメでした
~~~
phpunit –include-path /Applications/MAMP/bin/php/php5.3.6/lib/php/
~~~

実行する

testディレクトリ内でコマンドを叩く

~~~
phpunit –colors –verbose TestSuite TestSuite.php
~~~
–colorsは色をつけるオプション
–verboseは詳細を見るオプション

結果

メンテされてるされてない以前にテストが殆ど書かれてませんでした(^_^;)
テスト通っていないメソッドは全部Net/URLを使っている部分なのでMAMPが原因かも??

~~~
PHPUnit 3.6.10 by Sebastian Bergmann.

.F.FFF…………..IIIIIII.IIIIIIIIIIIIIIIIIIIIIIIIIIIIII……. 65 / 65 (100%)

Time: 1 second, Memory: 12.50Mb

There were 4 failures:

1) LC_Page_Test::testGetLocation
Failed asserting that two strings are equal.
— Expected
+++ Actual
@@ @@
-‘http://test:8888/eccube-2.12.0/html/abouts/index.php’
+’http://test:8888/eccube-2.12.0/html/Users/homuhomu/www/eccube-2.12.0/html’

/Users/homuhomu/www/eccube-2.12.0/test/class/page/LC_Page_Test.php:92

2) LC_Page_Test::testGetLocationWithQueryString
Failed asserting that two strings are equal.
— Expected
+++ Actual
@@ @@
-‘http://test:8888/eccube-2.12.0/html/abouts/index.php?mode=update&type=text’
+’http://test:8888/eccube-2.12.0/html/Users/homuhomu/www/eccube-2.12.0/html?mode=update&type=text’

/Users/homuhomu/www/eccube-2.12.0/test/class/page/LC_Page_Test.php:122

3) LC_Page_Test::testGetLocationUseSSL
Failed asserting that two strings are equal.
— Expected
+++ Actual
@@ @@
-‘http://test:8888/eccube-2.12.0/html/abouts/index.php?mode=update&type=text’
+’http://test:8888/eccube-2.12.0/html/Users/homuhomu/www/eccube-2.12.0/html?mode=update&type=text’

/Users/homuhomu/www/eccube-2.12.0/test/class/page/LC_Page_Test.php:138

4) LC_Page_Test::testGetLocationWithDocumentRoot
Failed asserting that two strings are equal.
— Expected
+++ Actual
@@ @@
-‘http://test:8888/eccube-2.12.0/html/abouts/index.php’
+’http://test:8888/eccube-2.12.0/html/Users/homuhomu/www/eccube-2.12.0/html’

/Users/homuhomu/www/eccube-2.12.0/test/class/page/LC_Page_Test.php:155

There were 37 incomplete tests:

1) SC_Helper_Purchase_Test::testCompleteOrder
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:66

2) SC_Helper_Purchase_Test::testCancelOrder
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:77

3) SC_Helper_Purchase_Test::testRollbackOrder
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:88

4) SC_Helper_Purchase_Test::testVerifyChangeCart
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:99

5) SC_Helper_Purchase_Test::testGetOrderTemp
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:110

6) SC_Helper_Purchase_Test::testGetOrderTempByOrderId
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:121

7) SC_Helper_Purchase_Test::testSaveOrderTemp
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:132

8) SC_Helper_Purchase_Test::testClearShipmentItemTemp
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:168

9) SC_Helper_Purchase_Test::testSetShipmentItemTemp
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:179

10) SC_Helper_Purchase_Test::testGetShippingPref
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:190

11) SC_Helper_Purchase_Test::testIsMultiple
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:201

12) SC_Helper_Purchase_Test::testSaveShippingTemp
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:212

13) SC_Helper_Purchase_Test::testUnsetShippingTemp
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:223

14) SC_Helper_Purchase_Test::testCopyFromCustomer
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:234

15) SC_Helper_Purchase_Test::testCopyFromOrder
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:245

16) SC_Helper_Purchase_Test::testGetPaymentsByPrice
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:256

17) SC_Helper_Purchase_Test::testGetDelivDate
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:267

18) SC_Helper_Purchase_Test::testGetDateArray
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:278

19) SC_Helper_Purchase_Test::testGetDelivTime
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:289

20) SC_Helper_Purchase_Test::testGetDeliv
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:300

21) SC_Helper_Purchase_Test::testGetPayments
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:311

22) SC_Helper_Purchase_Test::testRegisterShipping
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:322

23) SC_Helper_Purchase_Test::testRegisterShipmentItem
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:333

24) SC_Helper_Purchase_Test::testRegisterOrderComplete
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:344

25) SC_Helper_Purchase_Test::testRegisterOrder
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:355

26) SC_Helper_Purchase_Test::testRegisterOrderDetail
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:366

27) SC_Helper_Purchase_Test::testGetOrder
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:377

28) SC_Helper_Purchase_Test::testGetOrderDetail
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:388

29) SC_Helper_Purchase_Test::testSetDownloadableFlgTo
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:399

30) SC_Helper_Purchase_Test::testGetShippings
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:410

31) SC_Helper_Purchase_Test::testGetShipmentItems
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:421

32) SC_Helper_Purchase_Test::testSendOrderMail
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:432

33) SC_Helper_Purchase_Test::testSfUpdateOrderStatus
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:443

34) SC_Helper_Purchase_Test::testSfUpdateOrderNameCol
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:454

35) SC_Helper_Purchase_Test::testIsUsePoint
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:465

36) SC_Helper_Purchase_Test::testIsAddPoint
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:476

37) SC_Helper_Purchase_Test::testCleanupSession
This test has not been implemented yet.

/Users/homuhomu/www/eccube-2.12.0/test/class/helper/SC_Helper_Purchase_Test.php:487

FAILURES!
Tests: 65, Assertions: 50, Failures: 4, Incomplete: 37.
~~~

seleniumも

EC-CUBEにはseleniumのテストも含まれているので、そのうちこちらも試してみようと思います
とりあえずPHPUnitからは実行できそうにないので諦めました

ホントは、Travis CIで実行してgithubで管理すればいいじゃないって書きたかったんだけどな