diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a33e503860e122d1a2e58cb4e8a21742bd03af11..6c1c666dcdf80d965ae2b65d25b19c328e8f3b4f 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 4e5b3cc05118e55f846186a2136b7dab1d94a65f..ce4684590410004d383ac4c99a0bfa098387b94d 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 f4e62d1791e546d84193345b8003ff3186c9fdb3..9d79786fb8cd3b3224f4828bcaca0f6a52ba23bd 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 ); }