├── .gitignore ├── README.md └── run.sh /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | trunk 3 | wp-cli.yml 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WordPress Core Contribution Kit 2 | 3 | WordPress core development environment with PHP built-in web server + WP-CLI. 4 | 5 | It is very easy to launch WordPress development environment from svn repository. 6 | 7 | ## Requires 8 | 9 | * php 5.4 or later 10 | * MySQL 11 | * Subversion 12 | 13 | ## How to use 14 | 15 | ``` 16 | $ mkdir ~/Desktop/wordpress && cd $_ 17 | $ curl https://raw.githubusercontent.com/miya0001/wp-core-contribution-kit/master/run.sh | bash 18 | ``` 19 | 20 | Or 21 | 22 | ``` 23 | $ mkdir ~/Desktop/wordpress && cd $_ 24 | $ curl https://raw.githubusercontent.com/miya0001/wp-core-contribution-kit/master/run.sh | bash -s 25 | ``` 26 | 27 | ### Running automated testing for WordPress core 28 | 29 | Move into `trunk/` directory. 30 | 31 | ``` 32 | $ cd trunk 33 | ``` 34 | 35 | Then just run. 36 | 37 | ``` 38 | $ phpunit 39 | ``` 40 | 41 | https://make.wordpress.org/core/handbook/testing/automated-testing/ 42 | 43 | ## Defaults 44 | 45 | ### WordPress 46 | 47 | * User: `admin` 48 | * Password: `admin` 49 | 50 | ### MySQL 51 | 52 | * db-user: `root` 53 | * db-pass: (empty) 54 | * db-name: `wptrunk` 55 | 56 | ### Databases 57 | 58 | * `wptrunk` - For WordPress 59 | * `wptest` - For PHPUnit 60 | 61 | ## Advanced Tips 62 | 63 | Add alias into your `~/.bash_profile` like following. 64 | 65 | ``` 66 | alias wpcore="curl https://raw.githubusercontent.com/miya0001/wp-core-contribution-kit/master/run.sh | bash -s " 67 | ``` 68 | 69 | Then just run: 70 | 71 | ``` 72 | $ wpcore 73 | ``` 74 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex; 4 | 5 | DB_USER=${1-root} 6 | DB_PASS=$2 7 | DB_NAME=${3-wptrunk} 8 | DB_TEST_NAME=wptest 9 | PORT=8080 10 | WP_PATH=$(pwd)/trunk/src 11 | WP_TITLE='WordPress Trunk' 12 | WP_DESC='Hello World!' 13 | 14 | if [ -e "$WP_PATH/wp-config.php" ]; then 15 | open http://127.0.0.1:$PORT 16 | wp server --host=0.0.0.0 --port=$PORT --docroot=$WP_PATH 17 | exit 0 18 | fi 19 | 20 | echo "path: trunk/src" > $(pwd)/wp-cli.yml 21 | 22 | if [ $DB_PASS ]; then 23 | echo "DROP DATABASE IF EXISTS $DB_NAME;" | mysql -u$DB_USER -p$DB_PASS 24 | echo "CREATE DATABASE $DB_NAME DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql -u$DB_USER -p$DB_PASS 25 | 26 | echo "DROP DATABASE IF EXISTS $DB_TEST_NAME;" | mysql -u$DB_USER -p$DB_PASS 27 | echo "CREATE DATABASE $DB_TEST_NAME DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql -u$DB_USER -p$DB_PASS 28 | else 29 | echo "DROP DATABASE IF EXISTS $DB_NAME;" | mysql -u$DB_USER 30 | echo "CREATE DATABASE $DB_NAME DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql -u$DB_USER 31 | 32 | echo "DROP DATABASE IF EXISTS $DB_TEST_NAME;" | mysql -u$DB_USER 33 | echo "CREATE DATABASE $DB_TEST_NAME DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql -u$DB_USER 34 | fi 35 | 36 | svn co http://develop.svn.wordpress.org/trunk/ trunk 37 | 38 | cat trunk/wp-tests-config-sample.php \ 39 | | sed -e s/youremptytestdbnamehere/$DB_TEST_NAME/ \ 40 | | sed -e s/yourusernamehere/$DB_USER/ \ 41 | | sed -e s/yourpasswordhere/$DB_PASS/ > trunk/wp-tests-config.php 42 | 43 | if [ $DB_PASS ]; then 44 | wp core config \ 45 | --dbhost=localhost \ 46 | --dbname="$DB_NAME" \ 47 | --dbuser="$DB_USER" \ 48 | --dbpass="$DB_PASS" \ 49 | --dbprefix=wp_ \ 50 | --locale=en_US \ 51 | --extra-php <