From aa87b0b4565808bb293a4d8c799da7d7e8d3c538 Mon Sep 17 00:00:00 2001 From: takman1 Date: Sun, 19 Nov 2017 21:11:30 +0000 Subject: [PATCH 1/3] Client's history clear alternative Another way to clear client's history. --- components/browser_kit.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/browser_kit.rst b/components/browser_kit.rst index e3464076c13..19b612d9a4d 100644 --- a/components/browser_kit.rst +++ b/components/browser_kit.rst @@ -225,6 +225,18 @@ also delete all the cookies:: // delete history $client->restart(); +You can also delete the client's history with the ``clear()`` method of client's ``History`` attribute:: + + use Acme\Client; + + // make a real request to an external site + $client = new Client(); + $client->request('GET', 'http://symfony.com'); + + //delete history + $client->getHistory() + ->clear(); + Learn more ---------- From 9d6b67e5c96a8735bde3b9af9e59665cfc62d295 Mon Sep 17 00:00:00 2001 From: takman1 Date: Sun, 26 Nov 2017 19:41:20 +0000 Subject: [PATCH 2/3] Client restart method extra comment Precise that client->restart() calls history->clear() and cookieJar->clear() --- components/browser_kit.rst | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/components/browser_kit.rst b/components/browser_kit.rst index 19b612d9a4d..f618a5302bb 100644 --- a/components/browser_kit.rst +++ b/components/browser_kit.rst @@ -222,20 +222,9 @@ also delete all the cookies:: $client = new Client(); $client->request('GET', 'http://symfony.com'); - // delete history + // reinitializes the browser state (history and cookies are deleted) $client->restart(); - -You can also delete the client's history with the ``clear()`` method of client's ``History`` attribute:: - - use Acme\Client; - - // make a real request to an external site - $client = new Client(); - $client->request('GET', 'http://symfony.com'); - - //delete history - $client->getHistory() - ->clear(); + // which internally calls history->clear() and cookieJar->clear() Learn more ---------- From df5d3052bc5051e75c1c7fc3b5283afd26f0576b Mon Sep 17 00:00:00 2001 From: takman1 Date: Sat, 16 Dec 2017 19:47:08 +0000 Subject: [PATCH 3/3] Client restart description Better maintainability with simpler comment. --- components/browser_kit.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/browser_kit.rst b/components/browser_kit.rst index f618a5302bb..0c3c0abb05e 100644 --- a/components/browser_kit.rst +++ b/components/browser_kit.rst @@ -222,9 +222,8 @@ also delete all the cookies:: $client = new Client(); $client->request('GET', 'http://symfony.com'); - // reinitializes the browser state (history and cookies are deleted) + // reset the client (history and cookies are cleared too) $client->restart(); - // which internally calls history->clear() and cookieJar->clear() Learn more ----------