Skip to content

Instantly share code, notes, and snippets.

@miya0001
Last active August 29, 2015 14:11
Show Gist options
  • Save miya0001/fdc361b5de4e56ad8109 to your computer and use it in GitHub Desktop.
Save miya0001/fdc361b5de4e56ad8109 to your computer and use it in GitHub Desktop.
wp-tests-install
#!/usr/bin/env bash
set -ex;
echo 'DROP DATABASE IF EXISTS wordpress_test;' | mysql -u root
rm -fr /tmp/wordpress
rm -fr /tmp/wordpress-tests-lib
bash $(wp --info --format=json | jq -r '.wp_cli_dir_path')/templates/install-wp-tests.sh wordpress_test root '' localhost latest;
@miya0001
Copy link
Author

PHPUnit用のWordPressインストーラー

以下のコマンドで必要なパッケージをインストールしておくこと。

$ brew install mysql wp-cli jq

また、MySQLを起動しておくには以下のコマンドで。

$ mysql.server start

準備ができたらローカルにダウンロードするか以下のコマンドを実行すれば、あとはphpunitだけでおっけー。

curl -L https://gist.githubusercontent.com/miya0001/fdc361b5de4e56ad8109/raw/2bf607d88355361f5c286de256214417d10fc018/gistfile1.sh | bash

@torounit
Copy link

phpunitが入ってなければ、以下のコマンドでインストールできます。

$ brew install phpunit

後は、https://firegoby.jp/archives/5498#phpunit を行えばテストが走ります。vagrant sshしないでテストが走ります!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment