/** * Test delete() * * @return void */ public function testDelete() { foreach ($this->screen_names as $sn) { try { $response = $this->Cache->delete($sn); $this->assertTrue($response); } catch (Exception $e) { $this->assertInstanceOf(CacheException::class, $e); } } }
<?php require_once __DIR__ . "/bootstrap.php"; use HirotoK\SaveTweet\App\SaveTweet; use HirotoK\SaveTweet\App\Cache; if (config("https") && !is_https()) { header("location: https://" . config("url") . "/show.php"); exit; } header("Content-Type: text/html; charset=utf-8", true); try { $conf = config("twitter"); $TwistOAuth = new TwistOAuth($conf["ck"], $conf["cs"], $conf["ot"], $conf["os"]); $SaveTweet = new SaveTweet(config("db"), $TwistOAuth); $Cache = new Cache($TwistOAuth); $filter = []; $user = filter_input(INPUT_GET, "user"); if (!empty($user) && is_string($user)) { foreach (explode(",", $user) as $sn) { $filter[] = $sn; } } $user_ids = []; $names = []; $create_cache = []; foreach ($SaveTweet->tweetsList() as $row) { $user_ids[] = $row["user_id"]; } if (count($user_ids) !== 0) { $statuses = $TwistOAuth->get("users/lookup", ["user_id" => implode(",", array_values(array_unique($user_ids)))]); foreach ($statuses as $status) {