Skip to content

Commit 9fa3919

Browse files
committed
Merge branch '3.4'
* 3.4: Added Best Practice guideline for partials/include Backporting #8600 [#8605] Updated the article a little more, using the tests/ directory. fix paths Move `schema_filter` option to the correct place Fix typo in "advanced ACL concepts" Add special Abstract prefix not usage for PHPUnit test cases
2 parents eb775bd + 843af05 commit 9fa3919

File tree

4 files changed

+38
-18
lines changed

4 files changed

+38
-18
lines changed

best_practices/templates.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ This recommendation aligns with Twig best practices, where variables and templat
3939
names use lowercased snake_case too (e.g. ``user_profile`` instead of ``userProfile``
4040
and ``edit_form.html.twig`` instead of ``EditForm.html.twig``).
4141

42+
.. best-practice::
43+
44+
Use a prefixed underscore for partial templates in template names.
45+
46+
You often want to reuse template code using the ``include`` function to avoid
47+
redundant code. To determine those partials easily in the filesystem you should
48+
prefix partials and any other template without HTML body or ``extends`` tag
49+
with a single underscore.
50+
4251
Twig Extensions
4352
---------------
4453

contributing/code/standards.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ Naming Conventions
190190

191191
* Use namespaces for all classes;
192192

193-
* Prefix abstract classes with ``Abstract``. Please note some early Symfony classes
194-
do not follow this convention and have not been renamed for backward compatibility
195-
reasons. However all new abstract classes must follow this naming convention;
193+
* Prefix all abstract classes with ``Abstract`` except PHPUnit ``*TestCase``.
194+
Please note some early Symfony classes do not follow this convention and
195+
have not been renamed for backward compatibility reasons. However all new
196+
abstract classes must follow this naming convention;
196197

197198
* Suffix interfaces with ``Interface``;
198199

reference/configuration/doctrine.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ Full Default Configuration
2222
some_custom_type:
2323
class: Acme\HelloBundle\MyCustomType
2424
commented: true
25-
# If defined, all the tables whose names match this regular expression are ignored
26-
# by the schema tool (in this example, any table name starting with `wp_`)
27-
#schema_filter: '/^(?!wp_)/'
25+
2826
2927
connections:
3028
# A collection of different named connections (e.g. default, conn2, etc)
@@ -77,6 +75,11 @@ Full Default Configuration
7775
mapping_types:
7876
# an array of mapping types
7977
name: []
78+
79+
# If defined, only the tables whose names match this regular expression are managed
80+
# by the schema tool (in this example, any table name not starting with `wp_`)
81+
#schema_filter: '/^(?!wp_)/'
82+
8083
slaves:
8184
8285
# a collection of named slave connections (e.g. slave1, slave2)

testing/bootstrap.rst

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,47 @@ running those tests. For example, if you're running a functional test and
66
have introduced a new translation resource, then you will need to clear your
77
cache before running those tests.
88

9-
To do this, first add the following file::
9+
To do this, first add a file that executes your bootstrap work::
1010

11-
// app/tests.bootstrap.php
11+
// tests/bootstrap.php
1212
if (isset($_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'])) {
13+
// executes the "php bin/console cache:clear" command
1314
passthru(sprintf(
14-
'php "%s/console" cache:clear --env=%s --no-warmup',
15+
'php "%s/../bin/console" cache:clear --env=%s --no-warmup',
1516
__DIR__,
1617
$_ENV['BOOTSTRAP_CLEAR_CACHE_ENV']
1718
));
1819
}
1920

20-
require __DIR__.'/autoload.php';
21+
require __DIR__.'/../vendor/autoload.php';
2122

22-
Replace the test bootstrap file ``autoload.php`` in ``phpunit.xml.dist``
23-
with ``tests.bootstrap.php``:
23+
Then, configure ``phpunit.xml.dist`` to execute this ``bootstra.php`` file
24+
before running the tests:
2425

2526
.. code-block:: xml
2627
2728
<!-- phpunit.xml.dist -->
28-
29-
<!-- ... -->
29+
<?xml version="1.0" encoding="UTF-8"?>
3030
<phpunit
31-
bootstrap = "tests.bootstrap.php"
31+
bootstrap="tests/bootstrap.php"
3232
>
33+
<!-- ... -->
34+
</phpunit>
3335
3436
Now, you can define in your ``phpunit.xml.dist`` file which environment you want the
3537
cache to be cleared:
3638

3739
.. code-block:: xml
3840
3941
<!-- phpunit.xml.dist -->
40-
<php>
41-
<env name="BOOTSTRAP_CLEAR_CACHE_ENV" value="test"/>
42-
</php>
42+
<?xml version="1.0" encoding="UTF-8"?>
43+
<phpunit>
44+
<!-- ... -->
45+
46+
<php>
47+
<env name="BOOTSTRAP_CLEAR_CACHE_ENV" value="test" />
48+
</php>
49+
</phpunit>
4350
4451
This now becomes an environment variable (i.e. ``$_ENV``) that's available
4552
in the custom bootstrap file (``tests.bootstrap.php``).

0 commit comments

Comments
 (0)