Skip to content

Commit 0d6e3a1

Browse files
committed
Merge branch '2.8' into 3.3
* 2.8: adding note to config Add "url" key in dbal configuration Update database.rst Fix docs about making external requests with BrowserKit
2 parents d809a8f + 4bbe654 commit 0d6e3a1

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

components/browser_kit.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ The BrowserKit Component
88
The BrowserKit component simulates the behavior of a web browser, allowing
99
you to make requests, click on links and submit forms programmatically.
1010

11+
.. note::
12+
13+
The BrowserKit component can only make internal requests to your application.
14+
If you need to make requests to external sites and applications, consider
15+
using `Goutte`_, a simple web scraper based on Symfony Components.
16+
1117
Installation
1218
------------
1319

@@ -60,7 +66,7 @@ URL::
6066
use Acme\Client;
6167

6268
$client = new Client();
63-
$crawler = $client->request('GET', 'http://symfony.com');
69+
$crawler = $client->request('GET', '/');
6470

6571
The value returned by the ``request()`` method is an instance of the
6672
:class:`Symfony\\Component\\DomCrawler\\Crawler` class, provided by the
@@ -78,7 +84,7 @@ performs the needed HTTP GET request to simulate the link click::
7884
use Acme\Client;
7985

8086
$client = new Client();
81-
$crawler = $client->request('GET', 'http://symfony.com');
87+
$crawler = $client->request('GET', '/product/123');
8288
$link = $crawler->selectLink('Go elsewhere...')->link();
8389
$client->click($link);
8490

@@ -120,7 +126,7 @@ retrieve any cookie while making requests with the client::
120126

121127
// Make a request
122128
$client = new Client();
123-
$crawler = $client->request('GET', 'http://symfony.com');
129+
$crawler = $client->request('GET', '/');
124130

125131
// Get the cookie Jar
126132
$cookieJar = $client->getCookieJar();
@@ -153,7 +159,7 @@ Looping Through Cookies
153159
154160
// Make a request
155161
$client = new Client();
156-
$crawler = $client->request('GET', 'http://symfony.com');
162+
$crawler = $client->request('GET', '/');
157163
158164
// Get the cookie Jar
159165
$cookieJar = $client->getCookieJar();
@@ -199,9 +205,8 @@ history::
199205

200206
use Acme\Client;
201207

202-
// make a real request to an external site
203208
$client = new Client();
204-
$client->request('GET', 'http://symfony.com');
209+
$client->request('GET', '/');
205210

206211
// select and click on a link
207212
$link = $crawler->selectLink('Documentation')->link();
@@ -218,9 +223,8 @@ also delete all the cookies::
218223

219224
use Acme\Client;
220225

221-
// make a real request to an external site
222226
$client = new Client();
223-
$client->request('GET', 'http://symfony.com');
227+
$client->request('GET', '/');
224228

225229
// delete history
226230
$client->restart();

reference/configuration/doctrine.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ The following block shows all possible configuration keys:
300300
user: user
301301
password: secret
302302
driver: pdo_mysql
303+
# if the url option is specified, it will override the above config
304+
url: mysql://db_user:db_password@127.0.0.1:3306/db_name
303305
# the DBAL driverClass option
304306
driver_class: MyNamespace\MyDriverImpl
305307
# the DBAL driverOptions option

testing/database.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ How to Test Code that Interacts with the Database
66

77
If your code interacts with the database, e.g. reads data from or stores data
88
into it, you need to adjust your tests to take this into account. There are
9-
many ways how to deal with this. In a unit test, you can create a mock for
9+
many ways to deal with this. In a unit test, you can create a mock for
1010
a ``Repository`` and use it to return expected objects. In a functional test,
1111
you may need to prepare a test database with predefined values to ensure that
1212
your test always has the same data to work with.

0 commit comments

Comments
 (0)