From 61cdfcca89b456d5bbc43ee2c3f60e75b73ee0f2 Mon Sep 17 00:00:00 2001
From: Philipp Rieber
Date: Sun, 15 Dec 2013 11:16:28 +0100
Subject: [PATCH 1/3] [Testing] Fix phpunit test dir paths
---
book/testing.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/book/testing.rst b/book/testing.rst
index 2c8fcf9eeb2..d349cdbb448 100644
--- a/book/testing.rst
+++ b/book/testing.rst
@@ -775,7 +775,7 @@ create a ``phpunit.xml`` file to tweak the configuration for your local machine.
``phpunit.xml`` file.
By default, only the tests stored in "standard" bundles are run by the
-``phpunit`` command (standard being tests in the ``src/*/Bundle/Tests`` or
+``phpunit`` command (standard being tests in the ``src/*/*Bundle/Tests`` or
``src/*/Bundle/*Bundle/Tests`` directories) But you can easily add more
directories. For instance, the following configuration adds the tests from
the installed third-party bundles:
From d17a20f6b0dc7f2dae348b62de96d71517fe239e Mon Sep 17 00:00:00 2001
From: Philipp Rieber
Date: Thu, 2 Jan 2014 10:17:21 +0100
Subject: [PATCH 2/3] Further tweaks to the PHPUnit configuration description
---
book/testing.rst | 87 ++++++++++++++++++++++++++++++++----------------
1 file changed, 58 insertions(+), 29 deletions(-)
diff --git a/book/testing.rst b/book/testing.rst
index d349cdbb448..8e976fe8016 100644
--- a/book/testing.rst
+++ b/book/testing.rst
@@ -21,7 +21,7 @@ it has its own excellent `documentation`_.
needed to test the Symfony core code itself.
Each test - whether it's a unit test or a functional test - is a PHP class
-that should live in the `Tests/` subdirectory of your bundles. If you follow
+that should live in the ``Tests/`` subdirectory of your bundles. If you follow
this rule, then you can run all of your application's tests with the following
command:
@@ -686,7 +686,7 @@ their type::
Testing Configuration
---------------------
-The Client used by functional tests creates a Kernel that runs in a special
+The client used by functional tests creates a Kernel that runs in a special
``test`` environment. Since Symfony loads the ``app/config/config_test.yml``
in the ``test`` environment, you can tweak any of your application's settings
specifically for testing.
@@ -766,47 +766,76 @@ PHPUnit Configuration
~~~~~~~~~~~~~~~~~~~~~
Each application has its own PHPUnit configuration, stored in the
-``phpunit.xml.dist`` file. You can edit this file to change the defaults or
-create a ``phpunit.xml`` file to tweak the configuration for your local machine.
+``app/phpunit.xml.dist`` file. You can edit this file to change the defaults or
+create a ``app/phpunit.xml`` file to setup a configuration for your local
+machine only.
.. tip::
- Store the ``phpunit.xml.dist`` file in your code repository, and ignore the
+ Store the ``phpunit.xml.dist`` file in your code repository and ignore the
``phpunit.xml`` file.
-By default, only the tests stored in "standard" bundles are run by the
-``phpunit`` command (standard being tests in the ``src/*/*Bundle/Tests`` or
-``src/*/Bundle/*Bundle/Tests`` directories) But you can easily add more
-directories. For instance, the following configuration adds the tests from
-the installed third-party bundles:
+By default, only the tests from your own custom bundles stored in the standard
+directories ``src/*/*Bundle/Tests`` or ``src/*/Bundle/*Bundle/Tests`` are run
+by the ``phpunit`` command:
.. code-block:: xml
-
-
-
- ../src/*/*Bundle/Tests
- ../src/Acme/Bundle/*Bundle/Tests
-
-
+
+
+
+
+
+
+ ../src/*/*Bundle/Tests
+ ../src/*/Bundle/*Bundle/Tests
+
+
+
+
+
+But you can easily add more directories. For instance, the following
+configuration adds tests from a custom ``lib/tests`` directory:
+
+.. code-block:: xml
+
+
+
+
+
+
+
+
+ ../lib/tests
+
+
+
+
To include other directories in the code coverage, also edit the ````
section:
.. code-block:: xml
-
-
-
- ../src
-
- ../src/*/*Bundle/Resources
- ../src/*/*Bundle/Tests
- ../src/Acme/Bundle/*Bundle/Resources
- ../src/Acme/Bundle/*Bundle/Tests
-
-
-
+
+
+
+
+
+
+ ../src
+ ../lib
+
+ ../src/*/*Bundle/Resources
+ ../src/*/*Bundle/Tests
+ ../src/*/Bundle/*Bundle/Resources
+ ../src/*/Bundle/*Bundle/Tests
+ ../lib/tests
+
+
+
+
+
Learn more
----------
From 75bd1e51e342cb34e9ddc1d0271aad72acfc527a Mon Sep 17 00:00:00 2001
From: Philipp Rieber
Date: Thu, 2 Jan 2014 13:22:15 +0100
Subject: [PATCH 3/3] Fixes after review
---
book/testing.rst | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/book/testing.rst b/book/testing.rst
index 8e976fe8016..2db5d76c55d 100644
--- a/book/testing.rst
+++ b/book/testing.rst
@@ -686,7 +686,7 @@ their type::
Testing Configuration
---------------------
-The client used by functional tests creates a Kernel that runs in a special
+The Client used by functional tests creates a Kernel that runs in a special
``test`` environment. Since Symfony loads the ``app/config/config_test.yml``
in the ``test`` environment, you can tweak any of your application's settings
specifically for testing.
@@ -767,7 +767,7 @@ PHPUnit Configuration
Each application has its own PHPUnit configuration, stored in the
``app/phpunit.xml.dist`` file. You can edit this file to change the defaults or
-create a ``app/phpunit.xml`` file to setup a configuration for your local
+create an ``app/phpunit.xml`` file to setup a configuration for your local
machine only.
.. tip::
@@ -777,12 +777,11 @@ machine only.
By default, only the tests from your own custom bundles stored in the standard
directories ``src/*/*Bundle/Tests`` or ``src/*/Bundle/*Bundle/Tests`` are run
-by the ``phpunit`` command:
+by the ``phpunit`` command, as configured in the ``phpunit.xml.dist`` file:
.. code-block:: xml
-
@@ -800,7 +799,6 @@ configuration adds tests from a custom ``lib/tests`` directory:
.. code-block:: xml
-
@@ -818,18 +816,14 @@ section:
.. code-block:: xml
-
- ../src
+
../lib
- ../src/*/*Bundle/Resources
- ../src/*/*Bundle/Tests
- ../src/*/Bundle/*Bundle/Resources
- ../src/*/Bundle/*Bundle/Tests
+
../lib/tests