Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
inc2734 committed Oct 13, 2016
1 parent c7ea701 commit 7945bbe
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 50 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ Minizuku is a WordPress theme to develop the child theme.

## Required
* PHP 5.6+
* WP-CLI

## How to build
1. `$ npm install`
2. `$ npm run gulp build`
3. `$ composer install`

## Start up build-in server
```
Expand All @@ -28,7 +30,7 @@ $ bash app/bin/theme-unit-test.sh

## Generate files needed for running PHPUnit tests.
```
$ bash app/bin/scoffold-tests.sh
$ bash app/bin/scaffold-tests.sh
```

## Run PHPUnit tests
Expand Down
26 changes: 26 additions & 0 deletions app/bin/scaffold-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

themedir=$(wp theme path $(wp theme list --field=name --status=active) --dir)
phar extract -f $(which wp) "$themedir/app/bin/wp.phar">/dev/null 2>&1
wpclidir="$themedir/app/bin/wp.phar$(which wp)"

if [ ! -e "$themedir/app/bin" ]; then
mkdir -p "$themedir/app/bin"
fi

cp -f "$wpclidir/templates/install-wp-tests.sh" "$themedir/app/bin/install-wp-tests.sh"

cp -f "$wpclidir/templates/phpunit.xml.dist" "$themedir/phpunit.xml"

if [ ! -e "$themedir/tests" ]; then
mkdir "$themedir/tests"
fi

cp -f "$wpclidir/templates/bootstrap.mustache" "$themedir/tests/bootstrap.mustache"
sed -e "s/require dirname( dirname( __FILE__ ) ) \. '\/{{plugin_slug}}\.php';/register_theme_directory( dirname( __FILE__ ) . '\/\.\.\/\.\.\/' ); switch_theme('mimizuku');/g" "$themedir/tests/bootstrap.mustache">"$themedir/tests/bootstrap.php"
rm -f "$themedir/tests/bootstrap.mustache"

cp -f "$wpclidir/templates/test-sample.mustache" "$themedir/tests/test-sample.php"

rm -rf "$themedir/app/bin/wp.phar"
echo "done!"
22 changes: 0 additions & 22 deletions app/bin/scoffold-tests.sh

This file was deleted.

4 changes: 2 additions & 2 deletions app/bin/theme-unit-test-ja.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

dir=`dirname $0`
datetime=`date +%Y%m%d%H%M%S`
wp db export "$dir/dump-$datetime.sql"
wp db export "$dir/../../dump-$datetime.sql"

if [ -e "$dir/dump-$datetime.sql" ]; then
if [ -e "$dir/../../dump-$datetime.sql" ]; then
wp plugin install --activate wordpress-importer
wp plugin is-installed wordpress-importer

Expand Down
4 changes: 2 additions & 2 deletions app/bin/theme-unit-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

dir=`dirname $0`
datetime=`date +%Y%m%d%H%M%S`
wp db export "$dir/dump-$datetime.sql"
wp db export "$dir/../../dump-$datetime.sql"

if [ -e "$dir/dump-$datetime.sql" ]; then
if [ -e "$dir/../../dump-$datetime.sql" ]; then
wp plugin install --activate wordpress-importer
wp plugin is-installed wordpress-importer

Expand Down
4 changes: 3 additions & 1 deletion app/bin/wpphpunit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -ex;

dir=`dirname $0`

echo 'DROP DATABASE IF EXISTS wordpress_test;' | mysql -u root

if [ -e /tmp/wordpress ]; then
Expand All @@ -12,5 +14,5 @@ if [ -e /tmp/wordpress-tests-lib ]; then
rm -fr /tmp/wordpress-tests-lib
fi

bash app/bin/install-wp-tests.sh wordpress_test root '' localhost latest;
bash "$dir/install-wp-tests.sh" wordpress_test root '' localhost latest;
phpunit
34 changes: 17 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
},
"dependencies": {
"font-awesome": "^4.6.3",
"getbasis": "^1.0.5",
"getbasis": "^2.0.0",
"getbasis-drawer": "^2.0.0",
"getbasis-hamburger-btn": "^1.0.0",
"getbasis-layout": "^2.0.0",
"getbasis-menu": "^2.0.0"
},
"devDependencies": {
"autoprefixer": "^6.4.1",
"babel-preset-es2015": "^6.14.0",
"autoprefixer": "^6.5.1",
"babel-preset-es2015": "^6.16.0",
"babelify": "^7.3.0",
"browser-sync": "^2.16.0",
"browser-sync": "^2.17.3",
"browserify": "^13.1.0",
"browserify-shim": "^3.8.12",
"cssnano": "^3.7.5",
"cssnano": "^3.7.7",
"gulp": "^3.9.1",
"gulp-postcss": "^6.2.0",
"gulp-rename": "^1.2.2",
Expand Down

0 comments on commit 7945bbe

Please sign in to comment.