Skip to content

Commit 3083e90

Browse files
committed
[#5917] Finding some more places with the old directory structure referenced
1 parent 0e53bb5 commit 3083e90

File tree

6 files changed

+24
-29
lines changed

6 files changed

+24
-29
lines changed

book/testing.rst

+18-23
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ it has its own excellent `documentation`_.
2121
to use version 4.2 or higher to test the Symfony core code itself).
2222

2323
Each test - whether it's a unit test or a functional test - is a PHP class
24-
that should live in the ``Tests/`` subdirectory of your bundles. If you follow
24+
that should live in the ``tests/`` directory of your application. If you follow
2525
this rule, then you can run all of your application's tests with the following
2626
command:
2727

2828
.. code-block:: bash
2929
30-
# specify the configuration directory on the command line
3130
$ phpunit
3231
3332
PHPunit is configured by the ``phpunit.xml.dist`` file in the root of your
@@ -63,11 +62,11 @@ called ``Calculator`` in the ``Util/`` directory of the app bundle::
6362
}
6463
}
6564

66-
To test this, create a ``CalculatorTest`` file in the ``Tests/Util`` directory
65+
To test this, create a ``CalculatorTest`` file in the ``tests/AppBundle/Util`` directory
6766
of your bundle::
6867

69-
// src/AppBundle/Tests/Util/CalculatorTest.php
70-
namespace AppBundle\Tests\Util;
68+
// tests/AppBundle/Util/CalculatorTest.php
69+
namespace Tests\AppBundle\Util;
7170

7271
use AppBundle\Util\Calculator;
7372

@@ -85,13 +84,13 @@ of your bundle::
8584

8685
.. note::
8786

88-
By convention, the ``Tests/`` sub-directory should replicate the directory
89-
of your bundle for unit tests. So, if you're testing a class in your
90-
bundle's ``Util/`` directory, put the test in the ``Tests/Util/``
87+
By convention, the ``Tests/AppBundle`` directory should replicate the directory
88+
of your bundle for unit tests. So, if you're testing a class in the
89+
``AppBundle/Util/`` directory, put the test in the ``tests/AppBundle/Util/``
9190
directory.
9291

9392
Just like in your real application - autoloading is automatically enabled
94-
via the ``bootstrap.php.cache`` file (as configured by default in the
93+
via the ``autoload.php`` file (as configured by default in the
9594
``phpunit.xml.dist`` file).
9695

9796
Running tests for a given file or directory is also very easy:
@@ -102,13 +101,13 @@ Running tests for a given file or directory is also very easy:
102101
$ phpunit
103102
104103
# run all tests in the Util directory
105-
$ phpunit src/AppBundle/Tests/Util
104+
$ phpunit tests/AppBundle/Util
106105
107106
# run tests for the Calculator class
108-
$ phpunit src/AppBundle/Tests/Util/CalculatorTest.php
107+
$ phpunit tests/AppBundle/Util/CalculatorTest.php
109108
110109
# run all tests for the entire Bundle
111-
$ phpunit src/AppBundle/
110+
$ phpunit tests/AppBundle/
112111
113112
.. index::
114113
single: Tests; Functional tests
@@ -129,15 +128,15 @@ tests as far as PHPUnit is concerned, but they have a very specific workflow:
129128
Your First Functional Test
130129
~~~~~~~~~~~~~~~~~~~~~~~~~~
131130

132-
Functional tests are simple PHP files that typically live in the ``Tests/Controller``
133-
directory of your bundle. If you want to test the pages handled by your
131+
Functional tests are simple PHP files that typically live in the ``tests/AppBundle/Controller``
132+
directory for your bundle. If you want to test the pages handled by your
134133
``PostController`` class, start by creating a new ``PostControllerTest.php``
135134
file that extends a special ``WebTestCase`` class.
136135

137136
As an example, a test could look like this::
138137

139-
// src/AppBundle/Tests/Controller/PostControllerTest.php
140-
namespace AppBundle\Tests\Controller;
138+
// tests/AppBundle/Controller/PostControllerTest.php
139+
namespace Tests\AppBundle\Controller;
141140

142141
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
143142

@@ -810,10 +809,8 @@ only.
810809
Store the ``phpunit.xml.dist`` file in your code repository and ignore
811810
the ``phpunit.xml`` file.
812811

813-
By default, only the tests from your own custom bundles stored in the standard
814-
directories ``src/*/*Bundle/Tests``, ``src/*/Bundle/*Bundle/Tests``,
815-
``src/*Bundle/Tests`` are run by the ``phpunit`` command, as configured
816-
in the ``phpunit.xml.dist`` file:
812+
By default, only the tests stored in ``/tests`` are run via the ``phpunit`` command,
813+
as configured in the ``phpunit.xml.dist`` file:
817814

818815
.. code-block:: xml
819816
@@ -822,9 +819,7 @@ in the ``phpunit.xml.dist`` file:
822819
<!-- ... -->
823820
<testsuites>
824821
<testsuite name="Project Test Suite">
825-
<directory>../src/*/*Bundle/Tests</directory>
826-
<directory>../src/*/Bundle/*Bundle/Tests</directory>
827-
<directory>../src/*Bundle/Tests</directory>
822+
<directory>tests</directory>
828823
</testsuite>
829824
</testsuites>
830825
<!-- ... -->

cookbook/configuration/override_dir_structure.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ in your ``app.php`` and ``app_dev.php`` front controllers. If you simply
9797
renamed the directory, you're fine. But if you moved it in some way, you
9898
may need to modify these paths inside those files::
9999

100-
require_once __DIR__.'/../path/to/var/bootstrap.php.cache';
100+
require_once __DIR__.'/../path/to/app/autoload.php';
101101

102102
You also need to change the ``extra.symfony-web-dir`` option in the
103103
``composer.json`` file:

cookbook/deployment/azure-website.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ directory with at least the following contents:
259259

260260
.. code-block:: text
261261
262-
/app/bootstrap.php.cache
262+
/var/bootstrap.php.cache
263263
/var/cache/*
264264
/app/config/parameters.yml
265265
/var/logs/*

cookbook/deployment/platformsh.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Platform.sh how to deploy your application (read more about
6363
# The mounts that will be performed when the package is deployed.
6464
mounts:
6565
"/var/cache": "shared:files/cache"
66-
"/app/logs": "shared:files/logs"
66+
"/var/logs": "shared:files/logs"
6767
6868
# The hooks that will be performed when the package is deployed.
6969
hooks:

cookbook/testing/bootstrap.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ First, add the following file::
1717
));
1818
}
1919

20-
require __DIR__.'/bootstrap.php.cache';
20+
require __DIR__.'/autoload.php';
2121

22-
Replace the test bootstrap file ``bootstrap.php.cache`` in ``phpunit.xml.dist``
22+
Replace the test bootstrap file ``autoload.php`` in ``phpunit.xml.dist``
2323
with ``tests.bootstrap.php``:
2424

2525
.. code-block:: xml

quick_tour/the_architecture.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ and help you fix the problem quickly.
286286
Using the Command Line Interface
287287
--------------------------------
288288

289-
Each application comes with a command line interface tool (``app/console``)
289+
Each application comes with a command line interface tool (``bin/console``)
290290
that helps you maintain your application. It provides commands that boost
291291
your productivity by automating tedious and repetitive tasks.
292292

0 commit comments

Comments
 (0)