/** * Test create() * * @return void */ public function testCreate() { foreach ($this->screen_names as $sn) { try { $id = $this->Cache->sn2id($sn); $response = $this->Cache->create($id); $this->assertTrue($response); } catch (Exception $e) { $this->assertInstanceOf(CacheException::class, $e); } } }
foreach ($statuses as $status) { if ($Cache->exists($status->id_str)) { $json = json_decode(file_get_contents(config("cache.path") . "/{$status->id_str}/data.json")); $names[$status->id_str]["name"] = $json->name; $names[$status->id_str]["screen_name"] = $json->screen_name; $names[$status->id_str]["icon"] = $json->icon; continue; } $create_cache[] = $status->id_str; $names[$status->id_str] = ["name" => $status->name, "icon" => str_replace("_normal", "", $status->profile_image_url_https)]; } foreach ($create_cache as $id) { if ($Cache->exists($id) && $Cache->update_at($id) >= 1) { $Cache->update($id); } else { $Cache->create($id); } } } } catch (TwistException $e) { $errors = ["Twitterでエラーが発生しました。", $e->getMessage()]; } catch (Exception $e) { $errors = ["エラーが発生しました。", $e->getMessage()]; } ?> <!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>Show | SaveTweet</title> <meta name="description" content="このサイトはTwitterのツイートを出来るアプリ、SaveTweetの閲覧ページです。">