Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 85 additions & 10 deletions features/install-wp-tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,23 @@ Feature: Scaffold install-wp-tests.sh tests
And save STDOUT as {PHPUNIT_PHAR_URL}
And I run `curl -sS -L --fail -o phpunit {PHPUNIT_PHAR_URL}`
And I run `wp scaffold plugin hello-world`
And a mysql-client.sh file:
"""
# {DB_HOST} can be a host, a host:port or a host:/path/to/socket.
host={DB_HOST}
case "$host" in
*:/*) set -- -h"${host%%:*}" --socket="${host#*:}" "$@" ;;
*:*) set -- -h"${host%%:*}" -P"${host#*:}" --protocol=tcp "$@" ;;
*) set -- -h"$host" --protocol=tcp "$@" ;;
esac
client=mysql
if command -v mariadb > /dev/null 2>&1; then
client=mariadb
fi
"$client" -u{DB_USER} -p{DB_PASSWORD} "$@"
"""
# This throws a warning for the password provided via command line.
And I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`
And I try `bash mysql-client.sh -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`

When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest`
Then the return code should be 0
Expand Down Expand Up @@ -93,7 +108,7 @@ Feature: Scaffold install-wp-tests.sh tests
"""

# This throws a warning for the password provided via command line.
When I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "SHOW DATABASES"`
When I try `bash mysql-client.sh -e "SHOW DATABASES"`
Then STDOUT should contain:
"""
wp_cli_test_scaffold
Expand Down Expand Up @@ -163,8 +178,23 @@ Feature: Scaffold install-wp-tests.sh tests
And save STDOUT as {PHPUNIT_PHAR_URL}
And I run `curl -sS --fail -L -o phpunit {PHPUNIT_PHAR_URL}`
And I run `wp scaffold plugin hello-world`
And a mysql-client.sh file:
"""
# {DB_HOST} can be a host, a host:port or a host:/path/to/socket.
host={DB_HOST}
case "$host" in
*:/*) set -- -h"${host%%:*}" --socket="${host#*:}" "$@" ;;
*:*) set -- -h"${host%%:*}" -P"${host#*:}" --protocol=tcp "$@" ;;
*) set -- -h"$host" --protocol=tcp "$@" ;;
esac
client=mysql
if command -v mariadb > /dev/null 2>&1; then
client=mariadb
fi
"$client" -u{DB_USER} -p{DB_PASSWORD} "$@"
"""
# This throws a warning for the password provided via command line.
And I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`
And I try `bash mysql-client.sh -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`

When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest`
Then the return code should be 0
Expand Down Expand Up @@ -209,7 +239,7 @@ Feature: Scaffold install-wp-tests.sh tests
"""

# This throws a warning for the password provided via command line.
When I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "SHOW DATABASES"`
When I try `bash mysql-client.sh -e "SHOW DATABASES"`
Then STDOUT should contain:
"""
wp_cli_test_scaffold
Expand Down Expand Up @@ -291,8 +321,23 @@ Feature: Scaffold install-wp-tests.sh tests
And save STDOUT as {PHPUNIT_PHAR_URL}
And I run `curl -sS -L --fail -o phpunit {PHPUNIT_PHAR_URL}`
And I run `wp scaffold plugin hello-world`
And a mysql-client.sh file:
"""
# {DB_HOST} can be a host, a host:port or a host:/path/to/socket.
host={DB_HOST}
case "$host" in
*:/*) set -- -h"${host%%:*}" --socket="${host#*:}" "$@" ;;
*:*) set -- -h"${host%%:*}" -P"${host#*:}" --protocol=tcp "$@" ;;
*) set -- -h"$host" --protocol=tcp "$@" ;;
esac
client=mysql
if command -v mariadb > /dev/null 2>&1; then
client=mariadb
fi
"$client" -u{DB_USER} -p{DB_PASSWORD} "$@"
"""
# This throws a warning for the password provided via command line.
And I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`
And I try `bash mysql-client.sh -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`

When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest`
Then the return code should be 0
Expand Down Expand Up @@ -337,7 +382,7 @@ Feature: Scaffold install-wp-tests.sh tests
"""

# This throws a warning for the password provided via command line.
When I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "SHOW DATABASES"`
When I try `bash mysql-client.sh -e "SHOW DATABASES"`
Then STDOUT should contain:
"""
wp_cli_test_scaffold
Expand Down Expand Up @@ -399,8 +444,23 @@ Feature: Scaffold install-wp-tests.sh tests
And save STDOUT as {PHPUNIT_PHAR_URL}
And I run `curl -sS -f -L -o phpunit {PHPUNIT_PHAR_URL}`
And I run `wp scaffold plugin hello-world`
And a mysql-client.sh file:
"""
# {DB_HOST} can be a host, a host:port or a host:/path/to/socket.
host={DB_HOST}
case "$host" in
*:/*) set -- -h"${host%%:*}" --socket="${host#*:}" "$@" ;;
*:*) set -- -h"${host%%:*}" -P"${host#*:}" --protocol=tcp "$@" ;;
*) set -- -h"$host" --protocol=tcp "$@" ;;
esac
client=mysql
if command -v mariadb > /dev/null 2>&1; then
client=mariadb
fi
"$client" -u{DB_USER} -p{DB_PASSWORD} "$@"
"""
# This throws a warning for the password provided via command line.
And I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`
And I try `bash mysql-client.sh -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`

When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} trunk`
Then the return code should be 0
Expand Down Expand Up @@ -458,7 +518,7 @@ Feature: Scaffold install-wp-tests.sh tests
"""

# This throws a warning for the password provided via command line.
When I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "SHOW DATABASES"`
When I try `bash mysql-client.sh -e "SHOW DATABASES"`
Then STDOUT should contain:
"""
wp_cli_test_scaffold
Expand All @@ -477,8 +537,23 @@ Feature: Scaffold install-wp-tests.sh tests
Scenario: Install WordPress 3.7 and phpunit will not run
Given a WP install
And I run `wp scaffold plugin hello-world`
And a mysql-client.sh file:
"""
# {DB_HOST} can be a host, a host:port or a host:/path/to/socket.
host={DB_HOST}
case "$host" in
*:/*) set -- -h"${host%%:*}" --socket="${host#*:}" "$@" ;;
*:*) set -- -h"${host%%:*}" -P"${host#*:}" --protocol=tcp "$@" ;;
*) set -- -h"$host" --protocol=tcp "$@" ;;
esac
client=mysql
if command -v mariadb > /dev/null 2>&1; then
client=mariadb
fi
"$client" -u{DB_USER} -p{DB_PASSWORD} "$@"
"""
# This throws a warning for the password provided via command line.
And I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`
And I try `bash mysql-client.sh -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`

When I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} 3.7`
Then the return code should be 0
Expand Down Expand Up @@ -526,7 +601,7 @@ Feature: Scaffold install-wp-tests.sh tests
"""

# This throws a warning for the password provided via command line.
When I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "SHOW DATABASES"`
When I try `bash mysql-client.sh -e "SHOW DATABASES"`
And STDOUT should contain:
"""
wp_cli_test_scaffold
Expand Down
17 changes: 16 additions & 1 deletion features/scaffold-theme-tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,23 @@ Feature: Scaffold theme unit tests
"""
<?php echo __FILE__ . " loaded.\n";
"""
And a mysql-client.sh file:
"""
# {DB_HOST} can be a host, a host:port or a host:/path/to/socket.
host={DB_HOST}
case "$host" in
*:/*) set -- -h"${host%%:*}" --socket="${host#*:}" "$@" ;;
*:*) set -- -h"${host%%:*}" -P"${host#*:}" --protocol=tcp "$@" ;;
*) set -- -h"$host" --protocol=tcp "$@" ;;
esac
client=mysql
if command -v mariadb > /dev/null 2>&1; then
client=mariadb
fi
"$client" -u{DB_USER} -p{DB_PASSWORD} "$@"
"""
# This throws a warning for the password provided via command line.
And I try `mysql -u{DB_USER} -p{DB_PASSWORD} -h{MYSQL_HOST} -P{MYSQL_PORT} --protocol=tcp -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`
And I try `bash mysql-client.sh -e "DROP DATABASE IF EXISTS wp_cli_test_scaffold"`

And I try `WP_TESTS_DIR={RUN_DIR}/wordpress-tests-lib WP_CORE_DIR={RUN_DIR}/wordpress {THEME_DIR}/t12child/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest`
Then the return code should be 0
Expand Down
Loading