3

Ubuntu 14.04 で WordPress Plugin Testing を実行しようとしています。WP-CLI のセットアップを行っていますが、必要なファイル (includes/functions.php) をダウンロードできません。

これは私が使用しているコマンドです:

bash bin/install-wp-tests.sh wordpress_test root '' localhost latest

これは出力です:

+ install_wp
+ '[' -d /tmp/wordpress/ ']'
+ return
+ install_test_suite
++ uname -s
+ [[ Linux == \D\a\r\w\i\n ]]
+ local ioption=-i
+ '[' '!' -d /tmp/wordpress-tests-lib ']'
+ cd /tmp/wordpress-tests-lib
+ '[' '!' -f wp-tests-config.php ']'
+ download https://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php /tmp/wordpress-tests-lib/wp-tests-config.php
++ which curl
+ '[' /opt/lampp/bin/curl ']'
+ curl -s https://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
+ sed -i 's:dirname( __FILE__ ) . '\''/src/'\'':'\''/tmp/wordpress/'\'':' /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i s/youremptytestdbnamehere/wordpress_test/ /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i s/yourusernamehere/root/ /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i s/yourpasswordhere// /tmp/wordpress-tests-lib/wp-tests-config.php
+ sed -i 's|localhost|localhost|' /tmp/wordpress-tests-lib/wp-tests-config.php
+ install_db
+ PARTS=(${DB_HOST//\:/ })
+ local PARTS
+ local DB_HOSTNAME=localhost
+ local DB_SOCK_OR_PORT=
+ local EXTRA=
+ '[' -z localhost ']'
++ echo
++ grep -e '^[0-9]\{1,\}$'
+ '[' ']'
+ '[' -z ']'
+ '[' -z localhost ']'
+ EXTRA=' --host=localhost --protocol=tcp'
+ mysqladmin create wordpress_test --user=root --password= --host=localhost --protocol=tcp
Warning: Using a password on the command line interface can be insecure.

phpunit コマンドを使用すると、エラーがスローされます。

Fatal error: require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/opt/lampp/lib/php')

私はオフィスにいるので、ファイアウォールがこのコマンドをブロックしている可能性があると思いますが、/etc/environment にプロキシを設定しています。

助けていただければ幸いです。

4

2 に答える 2

7

私はこの問題を抱えていました。

  1. ディレクトリ/tmp/wordpress-tests-libがないことを確認します。includes

  2. マシンにsvnがインストールされていることを確認します。実行しない場合sudo apt-get install subversion

  3. /tmp/wordpress-tests-libフォルダを削除する

  4. プラグイン ディレクトリ内でファイルを開き、Subversion 呼び出しのquietbin/install-wp-tests.shフラグを削除します。この行を変更します。

    svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
    
    to
    
    svn co https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
    
  5. install shell script コマンドを再度実行します。

これで、PHPUnit を実行して、デフォルトのテストが 1 つパスしたことを確認できるはずです。

于 2016-04-15T18:55:43.587 に答える
0

私は同じ問題を抱えていました。https://github.com/wp-cli/wp-cli/wiki/Plugin-Unit-Testsの指示に従って解決してください。具体的には、テスト環境を初期化する必要がありました。

bash bin/install-wp-tests.sh wordpress_test root '' localhost latest

ここで、wordpress_testはテスト データベース、rootは DB ユーザー、''パスワードを含みます。

その他のリソース:

于 2015-11-02T04:51:27.077 に答える