public function setUp() { parent::setUp(); WP_HTTP_TestCase::init(); update_option('wpghs_repository', self::REPO_OPTION_VALUE); update_option('wpghs_oauth_token', self::TOKEN_OPTION_VALUE); update_option('wpghs_host', self::HOST_OPTION_VALUE); $this->http_responder = array($this, 'mock_github_api'); }
public function setUp() { parent::setUp(); WP_HTTP_TestCase::init(); update_option('wpghs_repository', 'person/repo'); update_option('wpghs_oauth_token', 'the-token'); update_option('wpghs_host', 'github.api'); $this->http_responder = array($this, 'mock_github_api'); $this->api = new WordPress_GitHub_Sync_Api(); }
/** * Load the cache if caching is in use. * * @since 1.1.0 */ protected static function load_cache() { if (!self::$use_caching) { return; } // Save the cache after the tests have run. add_action('shutdown', array(__CLASS__, 'save_cache')); $request_fields = self::get_env('CACHE_REQUEST_FIELDS'); if (null !== $request_fields) { self::$cache_request_fields = array_flip(array_map('trim', explode(',', $request_fields))); } self::load_env('CACHE_GROUP'); self::$cache_dir = self::get_env('CACHE_DIR', dirname(__FILE__)); $cache_file = self::$cache_dir . '/' . self::$cache_group; if (!file_exists($cache_file)) { return; } $cache = file_get_contents($cache_file); self::$cache = unserialize($cache); }
<?php $_tests_dir = getenv('WP_TESTS_DIR'); if (!$_tests_dir) { $_tests_dir = '/tmp/wordpress-tests-lib'; } require_once $_tests_dir . '/includes/functions.php'; function _manually_load_plugin() { require dirname(__FILE__) . '/../wp-github-sync.php'; } tests_add_filter('muplugins_loaded', '_manually_load_plugin'); require $_tests_dir . '/includes/bootstrap.php'; require dirname(__FILE__) . '/../vendor/jdgrimes/wp-http-testcase/wp-http-testcase.php'; WP_HTTP_TestCase::init();