バージョン選択

フォーラム

メニュー

オンライン状況

31 人のユーザが現在オンラインです。 (17 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 31
もっと...

サイト内検索

質問 > その他 > PHPUnitの実行について

その他

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
suruseas
投稿日時: 2013/5/8 17:40
対応状況: −−−
半人前
登録日: 2013/5/8
居住地:
投稿: 21
PHPUnitの実行について
Ver2.12.3(正式版)をダウンロードしました。インストール後ソースに修正を加えず、下記サイトを参考にPHPUnitを通そうとしたのですが、エラーが発生します。

<参考サイト>
http://svn.ec-cube.net/open_trac/wiki/EC-CUBE標準規約/単体テストガイドライン


<エラー>
[exec] PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /xxxxxxx/data/class/util/GC_Utils.php on line 213



エラーを追うと

/data/class/util/SC_Utils.php:84

で再起が無限に起こっていました。
原因はサーバの環境変数($_SERVER['SERVER_NAME']、$_SERVER['SERVER_PORT'])がテスト実行時にセットされていなかった為、テスト実行時にグローバル変数をセットすれば通ると思います。
ただ、そもそも通常はテストが通る形で正式版がリリースされているので私の手順がおかしいと思われるのですがなにか足りない手順があるのでしょうか。


#PHP、PHPUnitともに不慣れなので質問自体が間違っているかもしれません・・・。

よろしくお願い致します。
suruseas
投稿日時: 2013/5/8 17:44
対応状況: −−−
半人前
登録日: 2013/5/8
居住地:
投稿: 21
Re: PHPUnitの実行について
すみません、テンプレです。
------------------------------------------------------------------------------------------
[EC-CUBE] Ver2.12.3正式版
[OS] CentOS6.4
[PHP] PHP 5.3.3
[PHPUnit] PHPUnit 3.7.19
------------------------------------------------------------------------------------------
suruseas
投稿日時: 2013/5/8 19:36
対応状況: −−−
半人前
登録日: 2013/5/8
居住地:
投稿: 21
Re: PHPUnitの実行について
グローバル変数セットしたんですけど、installページの判断はHTTPリクエストが飛ぶんですね。
てことは私、根本的に勘違いしているような…。
nanasess
投稿日時: 2013/5/8 20:05
対応状況: −−−
登録日: 2006/9/9
居住地:
投稿: 2311
Re: PHPUnitの実行について
インストーラが起動してしまっているようですが、EC-CUBE のインストールは完了していますか??
suruseas
投稿日時: 2013/5/8 20:34
対応状況: −−−
半人前
登録日: 2013/5/8
居住地:
投稿: 21
Re: PHPUnitの実行について
ご返答ありがとうございます。はい、インストールは完了しています。フロント側、管理機能側も動作は問題なく完了しています。

今回小さなカスタマイズを入れようと思い、現状動いている機能まで影響しないようにお守り代わりにJenkinsでCI回したかったんです。ちなみにJenkinsサーバは手元にあるものを使わざるをえなかったので、SHIFT様から提供されているプラグインは利用できませんでした。

その前段階でつまづいてしまった、という状況です。
nanasess
投稿日時: 2013/5/8 21:18
対応状況: −−−
登録日: 2006/9/9
居住地:
投稿: 2311
Re: PHPUnitの実行について
Jenkins で実行した場合に動作しない感じですか??

tests ディレクトリ内の、 phpunit.xml と require.php は適切に設定されていますか??
*.base と *.jenkins があるので、それぞれリネームして、適切に設定しなければいけません。

# カバレッジ率がまだまだなので、どうぞご協力をお願い致しますm(_ _)m
suruseas
投稿日時: 2013/5/8 23:01
対応状況: −−−
半人前
登録日: 2013/5/8
居住地:
投稿: 21
Re: PHPUnitの実行について
>tests ディレクトリ内の、 phpunit.xml と require.php は適切に設定されていますか??
>*.base と *.jenkins があるので、それぞれリネームして、適切に設定しなければいけません。

はい、修正した*つもり*です。

JenkinsでNGだったので参考サイトに従い

% phing test

で単体で実行しても無理でした。

#というか、PHPUnit実行でHTTP通信が発生するってことはseleniumみたいなサーバが起動していないってことなのでしょうか。

とりあえず、上記設定も「つもり」では不確実ですし、そもそも情報が不足していると思いますので、明日もう一度詳細を確認致します!
suruseas
投稿日時: 2013/5/10 10:32
対応状況: −−−
半人前
登録日: 2013/5/8
居住地:
投稿: 21
Re: PHPUnitの実行について
大変遅くなりました。操作手順及びログは以下となります。
よろしくお願い致します。

$ tar zxvf eccube-2.12.3.tar.gz
$ cd eccube-2.12.3
$ cp tests/phpunit.xml.base tests/phpunit.xml
$ cp tests/require.php.base tests/require.php
$ phing -verbose test
$ cat reports/stderr.log
PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /home/username/ダウンロード/eccube-2.12.3/data/class/util/GC_Utils.php on line 213
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/pear/PHPUnit/TextUI/Command.php:150
PHP 5. PHPUnit_Framework_TestSuite->addTestFiles() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:96
PHP 6. PHPUnit_Framework_TestSuite->addTestFile() /usr/share/pear/PHPUnit/Framework/TestSuite.php:416
PHP 7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/pear/PHPUnit/Framework/TestSuite.php:355
PHP 8. PHPUnit_Util_Fileloader::load() /usr/share/pear/PHPUnit/Util/Fileloader.php:76
PHP 9. include_once() /usr/share/pear/PHPUnit/Util/Fileloader.php:92
PHP 10. require_once() /home/username/ダウンロード/eccube-2.12.3/tests/class/SC_Date/SC_Date_AccessorTest.php:25
PHP 11. require_once() /home/username/ダウンロード/eccube-2.12.3/tests/class/Common_TestCase.php:8
PHP 12. require_once() /home/username/ダウンロード/eccube-2.12.3/tests/require.php:3
PHP 13. require_once() /home/username/ダウンロード/eccube-2.12.3/html/require.php:35
PHP 14. SC_Utils::sfInitInstall() /home/username/ダウンロード/eccube-2.12.3/data/require_base.php:38
PHP 15. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:44
PHP 16. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
PHP 17. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
PHP 18. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
〜以下繰り返しなので省略〜
PHP 94. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
PHP 95. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
PHP 96. fopen() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:82
PHP 97. SC_Helper_HandleError::handle_warning() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:82
PHP 98. GC_Utils::gfPrintLog() /home/username/ダウンロード/eccube-2.12.3/data/class/helper/SC_Helper_HandleError.php:107
PHP 99. GC_Utils::gfLogRotation() /home/username/ダウンロード/eccube-2.12.3/data/class/util/GC_Utils.php:197
PHP Fatal error: Call to a member function doAction() on a non-object in /home/username/ダウンロード/eccube-2.12.3/data/class/SC_View.php on line 137
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/pear/PHPUnit/TextUI/Command.php:150
PHP 5. PHPUnit_Framework_TestSuite->addTestFiles() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:96
PHP 6. PHPUnit_Framework_TestSuite->addTestFile() /usr/share/pear/PHPUnit/Framework/TestSuite.php:416
PHP 7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/pear/PHPUnit/Framework/TestSuite.php:355
PHP 8. PHPUnit_Util_Fileloader::load() /usr/share/pear/PHPUnit/Util/Fileloader.php:76
PHP 9. include_once() /usr/share/pear/PHPUnit/Util/Fileloader.php:92
PHP 10. require_once() /home/username/ダウンロード/eccube-2.12.3/tests/class/SC_Date/SC_Date_AccessorTest.php:25
PHP 11. require_once() /home/username/ダウンロード/eccube-2.12.3/tests/class/Common_TestCase.php:8
PHP 12. require_once() /home/username/ダウンロード/eccube-2.12.3/tests/require.php:3
PHP 13. require_once() /home/username/ダウンロード/eccube-2.12.3/html/require.php:35
PHP 14. SC_Utils::sfInitInstall() /home/username/ダウンロード/eccube-2.12.3/data/require_base.php:38
PHP 15. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:44
PHP 16. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
PHP 17. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
PHP 18. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
〜以下繰り返しなので省略〜
PHP 94. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
PHP 95. SC_Utils::searchInstallerPath() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:84
PHP 96. fopen() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:82
PHP 97. SC_Helper_HandleError::handle_warning() /home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php:82
PHP 98. GC_Utils::gfPrintLog() /home/username/ダウンロード/eccube-2.12.3/data/class/helper/SC_Helper_HandleError.php:107
PHP 99. GC_Utils::gfLogRotation() /home/username/ダウンロード/eccube-2.12.3/data/class/util/GC_Utils.php:197
PHP 101. SC_Helper_HandleError::handle_error() /home/username/ダウンロード/eccube-2.12.3/data/class/helper/SC_Helper_HandleError.php:0
PHP 102. SC_Helper_HandleError::displaySystemError() /home/username/ダウンロード/eccube-2.12.3/data/class/helper/SC_Helper_HandleError.php:180
PHP 103. LC_Page_Error_SystemError_Ex->process() /home/username/ダウンロード/eccube-2.12.3/data/class/helper/SC_Helper_HandleError.php:214
PHP 104. LC_Page_Error_SystemError->process() /home/username/ダウンロード/eccube-2.12.3/data/class_extends/page_extends/error/LC_Page_Error_SystemError_Ex.php:57
PHP 105. LC_Page_Error_SystemError->sendResponse() /home/username/ダウンロード/eccube-2.12.3/data/class/pages/error/LC_Page_Error_SystemError.php:66
PHP 106. SC_Display->prepare() /home/username/ダウンロード/eccube-2.12.3/data/class/pages/error/LC_Page_Error_SystemError.php:104
PHP 107. SC_View->getResponse() /home/username/ダウンロード/eccube-2.12.3/data/class/SC_Display.php:77
PHP 108. Smarty->fetch() /home/username/ダウンロード/eccube-2.12.3/data/class/SC_View.php:100
PHP 109. Smarty->_compile_resource() /home/username/ダウンロード/eccube-2.12.3/data/module/Smarty/libs/Smarty.class.php:1261
PHP 110. Smarty->_compile_source() /home/username/ダウンロード/eccube-2.12.3/data/module/Smarty/libs/Smarty.class.php:1422
PHP 111. Smarty_Compiler->_compile_file() /home/username/ダウンロード/eccube-2.12.3/data/module/Smarty/libs/Smarty.class.php:1489
PHP 112. call_user_func_array() /home/username/ダウンロード/eccube-2.12.3/data/module/Smarty/libs/Smarty_Compiler.class.php:249
PHP 113. SC_View->prefilter_transform() /home/username/ダウンロード/eccube-2.12.3/data/module/Smarty/libs/Smarty_Compiler.class.php:249
$ cat data/logs/error.log
2013/05/10 10:22:13 [/usr/bin/phpunit] Warning(E_WARNING): fopen(://:/) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: そのようなファイルやディレクトリはありません on [/home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php(82)] from
〜以下繰り返しなので省略〜
2013/05/10 10:22:13 [/usr/bin/phpunit] Warning(E_WARNING): fopen(://:/) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: そのようなファイルやディレクトリはありません on [/home/username/ダウンロード/eccube-2.12.3/data/class/util/SC_Utils.php(82)] from
2013/05/10 10:22:13 [/usr/bin/phpunit] Fatal error(E_ERROR): Maximum function nesting level of '100' reached, aborting! on [/home/username/ダウンロード/eccube-2.12.3/data/class/util/GC_Utils.php(213)] from
customer_id =
nanasess
投稿日時: 2013/5/10 10:39
対応状況: −−−
登録日: 2006/9/9
居住地:
投稿: 2311
Re: PHPUnitの実行について
引用:

$ cp tests/require.php.base tests/require.php
$ phing -verbose test


phing を実行する前に、 EC-CUBE をインストールしておく必要がありますが、インストールされていますか?

eccube-2.12.3/data/config/config.php は正常に作成されていますか?
ECCUBE_INSTALL 定数が ON になっていないと data/require_base.php によってインストーラのディレクトリを探しにいきます。
suruseas
投稿日時: 2013/5/10 16:05
対応状況: −−−
半人前
登録日: 2013/5/8
居住地:
投稿: 21
Re: PHPUnitの実行について
完全に申し訳ないです(汗

先ほどの手順はごちゃごちゃしてきたので、再度クリーンな環境で試した結果でした(そしてインストール作業を抜いてしまった、と)
ご指摘を踏まえてインストールが完了しているフォルダで実行したところ、単純にphpunit.xmlがないと怒られていました…。そこで、phpunit.xmlを作成したところテストが進んでいることを確認できました!ありがとうございます!!そしてすみません(汗

ただ、途中でエラーが発生してしまっています。これはこのスレで続けてしまってもよいですか?それとも別スレであげる内容でしょうか?

取り急ぎ、エラー内容を添付しました。


PHP Fatal error:  DB処理でエラーが発生しました。
SQL: [SELECT CASE WHEN EXISTS(SELECT * FROM dtb_session WHERE sess_id = ?   ) THEN 1 ELSE 0 END]
MDB2 Error: unknown error
prepare: [Error message: Unable to create prepared statement handle]
[Last executed query: EXECUTE mdb2_statement_pgsql_439c03bb9459173becf4842b269ef4432fef21e745 ('1001', NULL, '0', '2')]
[Native message: ERROR:  現在のトランザクションがアボートしました。トランザクションブロックが終わるまでコマンドは>無視されます]
 in /var/www/html/eccube/data/class/SC_Query.php on line 1007
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:129
PHP   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/pear/PHPUnit/TextUI/Command.php:176
PHP   5. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/TextUI/TestRunner.php:349
PHP   6. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:705
PHP   7. PHPUnit_Framework_TestSuite->runTest() /usr/share/pear/PHPUnit/Framework/TestSuite.php:745
PHP   8. PHPUnit_Framework_TestCase->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:775
PHP   9. PHPUnit_Framework_TestResult->run() /usr/share/pear/PHPUnit/Framework/TestCase.php:776
PHP  10. PHPUnit_Framework_TestCase->runBare() /usr/share/pear/PHPUnit/Framework/TestResult.php:648
PHP  11. PHPUnit_Framework_TestCase->runTest() /usr/share/pear/PHPUnit/Framework/TestCase.php:831
PHP  12. ReflectionMethod->invokeArgs() /usr/share/pear/PHPUnit/Framework/TestCase.php:976
PHP  13. SC_Product_setProductStatusTest->testSetProductStatus_登録した商品ステータスを返す() /usr/share/pear/PHPUnit/Framework/TestCase.php:976
PHP  14. SC_Product->setProductStatus() /var/www/html/eccube/tests/class/SC_Product/SC_Product_setProductStatusTest.php:27
PHP  15. SC_Query->insert() /var/www/html/eccube/data/class/SC_Product.php:484
PHP  16. SC_Query->query() /var/www/html/eccube/data/class/SC_Query.php:530
PHP  17. SC_Query->execute() /var/www/html/eccube/data/class/SC_Query.php:814
PHP  18. SC_Query->error() /var/www/html/eccube/data/class/SC_Query.php:970
PHP  19. trigger_error() /var/www/html/eccube/data/class/SC_Query.php:1007
PHP  20. SC_Helper_HandleError::handle_warning() /var/www/html/eccube/data/class/SC_Query.php:1007
PHP  21. SC_Helper_Session->sfSessWrite() /var/www/html/eccube/data/class/SC_Query.php:0
PHP  22. SC_Query->exists() /var/www/html/eccube/data/class/helper/SC_Helper_Session.php:89
PHP  23. SC_Query->getOne() /var/www/html/eccube/data/class/SC_Query.php:151
PHP  24. SC_Query->prepare() /var/www/html/eccube/data/class/SC_Query.php:647
PHP  25. SC_Query->error() /var/www/html/eccube/data/class/SC_Query.php:948
PHP  26. trigger_error() /var/www/html/eccube/data/class/SC_Query.php:1007
(1) 2 3 »
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,646名です
総投稿数は109,891件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2311
5
umebius
2085
6
yuh
1819
7
h_tanaka
1635
8
red
1569
9
mcontact
1265
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.