/** * @param bool $use_existing whether to create a new client or use existing if any, * default to true * @param bool $use_cache whether to use http cache * @return \Goutte\Client */ protected static function get_client($use_existing = true, $use_cache = false) { $client = self::$client && $use_existing ? self::$client : new Client(); // reset the existing client if not using it if (!$use_existing) { // use http cache if needed if ($use_cache) { $cache_plugin = new CachePlugin(); $client->getClient()->addSubscriber($cache_plugin); } self::$client = $client; } // do not verify SSL certificate $client->getClient()->setDefaultOption('verify', false); return $client; }
protected function bootstrap_plugin() { parent::bootstrap_plugin(); // need to define WP_SITEURL here to avoid an error with wp_guess_url() if (!defined('WP_SITEURL')) { define('WP_SITEURL', 'http://' . WP_TESTS_DOMAIN); } }