From 3794862a606166d1b9f801c86c1841c6bce8d696 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Tue, 7 Aug 2018 10:25:37 -0700 Subject: [PATCH] Cleanup --- .gitlab-ci.yml | 4 ++++ tests/bootstrap.php | 18 +++++++++--------- tests/test-sample.php | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a33e503..6c1c666 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,10 @@ variables: MYSQL_DATABASE: wordpress_tests MYSQL_ROOT_PASSWORD: mysql +cache: + paths: + - $HOME/.composer + before_script: # Install dependencies diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4e5b3cc..ce46845 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -5,27 +5,27 @@ * @package Camo_Image_Proxy */ -$_tests_dir = getenv( 'WP_TESTS_DIR' ); +$camo_tests_dir = getenv( 'WP_TESTS_DIR' ); -if ( ! $_tests_dir ) { - $_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; +if ( ! $camo_tests_dir ) { + $camo_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; } -if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) { - echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; +if ( ! file_exists( $camo_tests_dir . '/includes/functions.php' ) ) { + echo "Could not find $camo_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped exit( 1 ); } // Give access to tests_add_filter() function. -require_once $_tests_dir . '/includes/functions.php'; +require_once $camo_tests_dir . '/includes/functions.php'; /** * Manually load the plugin being tested. */ -function _manually_load_plugin() { +function camo_manually_load_plugin() { require dirname( dirname( __FILE__ ) ) . '/camo-image-proxy.php'; } -tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); +tests_add_filter( 'muplugins_loaded', 'camo_manually_load_plugin' ); // Start up the WP testing environment. -require $_tests_dir . '/includes/bootstrap.php'; +require $camo_tests_dir . '/includes/bootstrap.php'; diff --git a/tests/test-sample.php b/tests/test-sample.php index f4e62d1..9d79786 100755 --- a/tests/test-sample.php +++ b/tests/test-sample.php @@ -13,7 +13,7 @@ class SampleTest extends WP_UnitTestCase { /** * A single example test. */ - function test_sample() { + public function test_sample() { // Replace this with some actual testing code. $this->assertTrue( true ); } -- GitLab