Skip to content

Commit 8fd3422

Browse files
committed
Merge branch '2.0'
2 parents 9eebd0f + 9f3477c commit 8fd3422

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

book/testing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ for its ``DemoController`` (`DemoControllerTest`_) that reads as follows::
145145

146146
$crawler = $client->request('GET', '/demo/hello/Fabien');
147147

148-
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
148+
$this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count());
149149
}
150150
}
151151

@@ -211,7 +211,7 @@ that it actually does what you expect it to. Use the Crawler to make assertions
211211
on the DOM::
212212

213213
// Assert that the response matches a given CSS selector.
214-
$this->assertTrue($crawler->filter('h1')->count() > 0);
214+
$this->assertGreaterThan(0, $crawler->filter('h1')->count());
215215

216216
Or, test against the Response content directly if you just want to assert that
217217
the content contains some text, or if the Response is not an XML/HTML
@@ -259,10 +259,10 @@ document::
259259
useful test assertions::
260260

261261
// Assert that there is more than one h2 tag with the class "subtitle"
262-
$this->assertTrue($crawler->filter('h2.subtitle')->count() > 0);
262+
$this->assertGreaterThan(0, $crawler->filter('h2.subtitle')->count());
263263

264264
// Assert that there are exactly 4 h2 tags on the page
265-
$this->assertEquals(4, $crawler->filter('h2')->count());
265+
$this->assertCount(4, $crawler->filter('h2')->count());
266266

267267
// Assert the the "Content-Type" header is "application/json"
268268
$this->assertTrue($client->getResponse()->headers->contains('Content-Type', 'application/json'));

cookbook/form/form_collections.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,22 @@ So far, this works great, but this doesn't allow you to dynamically add new
246246
tags or delete existing tags. So, while editing existing tags will work
247247
great, your user can't actually add any new tags yet.
248248

249+
.. caution::
250+
251+
In this entry, we embed only one collection, but you are not limited
252+
to this. You can also embed nested collection as many level down as you
253+
like. But if you use Xdebug in your development setup, you may receive
254+
a ``Maximum function nesting level of '100' reached, aborting!`` error.
255+
This is due to the ``xdebug.max_nesting_level`` PHP setting, which defaults
256+
to ``100``.
257+
258+
This directive limits recursion to 100 calls which may not be enough for
259+
rendering the form in the template if you render the whole form at
260+
once (e.g ``form_widget(form)``). To fix this you can set this directive
261+
to a higher value (either via a PHP ini file or via :phpfunction:`ini_set`,
262+
for example in ``app/autoload.php``) or render each form field by hand
263+
using ``form_row``.
264+
249265
.. _cookbook-form-collections-new-prototype:
250266

251267
Allowing "new" tags with the "prototype"
@@ -622,4 +638,4 @@ the relationship between the removed ``Tag`` and ``Task`` object.
622638
each Tag object itself.
623639

624640

625-
.. _`Owning Side and Inverse Side`: http://docs.doctrine-project.org/en/latest/reference/unitofwork-associations.html
641+
.. _`Owning Side and Inverse Side`: http://docs.doctrine-project.org/en/latest/reference/unitofwork-associations.html

cookbook/testing/profiling.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ environment)::
2828
// Check that the profiler is enabled
2929
if ($profile = $client->getProfile()) {
3030
// check the number of requests
31-
$this->assertTrue($profile->getCollector('db')->getQueryCount() < 10);
31+
$this->assertLessThan(10, $profile->getCollector('db')->getQueryCount());
3232

3333
// check the time spent in the framework
34-
$this->assertTrue( $profile->getCollector('timer')->getTime() < 0.5);
34+
$this->assertLessThan(0.5, $profile->getCollector('timer')->getTime());
3535
}
3636
}
3737
}
@@ -40,8 +40,9 @@ If a test fails because of profiling data (too many DB queries for instance),
4040
you might want to use the Web Profiler to analyze the request after the tests
4141
finish. It's easy to achieve if you embed the token in the error message::
4242

43-
$this->assertTrue(
44-
$profile->get('db')->getQueryCount() < 30,
43+
$this->assertLessThan(
44+
30,
45+
$profile->get('db')->getQueryCount(),
4546
sprintf('Checks that query count is less than 30 (token %s)', $profile->getToken())
4647
);
4748

0 commit comments

Comments
 (0)