public static function display_retrieved_content($url, $path, $proto) { require_once __DIR__ . '/ZwsQueryAPI.php'; // grab the results from the API (or cache) $results = \ZwsApiConsumer\ZwsQueryAPI::getRecords($url, $path, $proto); if (is_array($results)) { // grab the content that we want from the returned json - methods defined per service $returned_content = self::getContent($results); return wp_kses_post($returned_content); } else { return '<strong style="color:red;">' . \ZwsApiConsumer\ZwsQueryAPI::$error . ' | ' . $results . '</strong>'; } }
function test_display_retrieved_content_twitter_memcached() { // tests retrieval of twitter timeline API with memcached switched ON. require __DIR__ . '/../src/SetOptions.php'; // arrange $url = 'api.twitter.com'; $path = '1.1/statuses/home_timeline.json'; $proto = 'https'; $args = array('debug' => TRUE, 'oauth' => 'TRUE', 'memcached_ip' => '127.0.0.1', 'memcached_port' => '11211', 'cache_period' => '3600', 'memcached_active' => 'TRUE', 'consumer_key' => '', 'consumer_secret' => '', 'token' => '', 'token_secret' => ''); // act $result = \ZwsApiConsumer\ZwsQueryAPI::getRecords($url, $path, $proto, $args); // assert $this->assertTrue(is_array($result)); }