description.html.twig
Same filename in this branch
- 8.x-1.x menu_example/templates/description.html.twig
- 8.x-1.x form_api_example/templates/description.html.twig
- 8.x-1.x js_example/templates/description.html.twig
- 8.x-1.x page_example/templates/description.html.twig
- 8.x-1.x node_type_example/templates/description.html.twig
- 8.x-1.x pager_example/templates/description.html.twig
- 8.x-1.x block_example/templates/description.html.twig
- 8.x-1.x tabledrag_example/templates/description.html.twig
- 8.x-1.x tour_example/templates/description.html.twig
- 8.x-1.x config_entity_example/templates/description.html.twig
- 8.x-1.x tests/modules/examples_description_test/templates/description.html.twig
- 8.x-1.x phpunit_example/templates/description.html.twig
- 8.x-1.x render_example/templates/description.html.twig
- 8.x-1.x field_permission_example/templates/description.html.twig
- 8.x-1.x stream_wrapper_example/templates/description.html.twig
- 8.x-1.x ajax_example/templates/description.html.twig
- 8.x-1.x hooks_example/templates/description.html.twig
- 8.x-1.x field_example/templates/description.html.twig
Same filename in other branches
- 3.x modules/menu_example/templates/description.html.twig
- 3.x modules/form_api_example/templates/description.html.twig
- 3.x modules/js_example/templates/description.html.twig
- 3.x modules/page_example/templates/description.html.twig
- 3.x modules/node_type_example/templates/description.html.twig
- 3.x modules/pager_example/templates/description.html.twig
- 3.x modules/block_example/templates/description.html.twig
- 3.x modules/tabledrag_example/templates/description.html.twig
- 3.x modules/rest_example/templates/description.html.twig
- 3.x modules/testing_example/templates/description.html.twig
- 3.x modules/tour_example/templates/description.html.twig
- 3.x modules/config_entity_example/templates/description.html.twig
- 3.x modules/phpunit_example/templates/description.html.twig
- 3.x modules/render_example/templates/description.html.twig
- 3.x modules/field_permission_example/templates/description.html.twig
- 3.x modules/stream_wrapper_example/templates/description.html.twig
- 3.x modules/ajax_example/templates/description.html.twig
- 3.x modules/hooks_example/templates/description.html.twig
- 3.x modules/field_example/templates/description.html.twig
- 3.x tests/modules/examples_description_test/templates/description.html.twig
- 4.0.x modules/menu_example/templates/description.html.twig
- 4.0.x modules/form_api_example/templates/description.html.twig
- 4.0.x modules/js_example/templates/description.html.twig
- 4.0.x modules/page_example/templates/description.html.twig
- 4.0.x modules/node_type_example/templates/description.html.twig
- 4.0.x modules/pager_example/templates/description.html.twig
- 4.0.x modules/block_example/templates/description.html.twig
- 4.0.x modules/tabledrag_example/templates/description.html.twig
- 4.0.x modules/rest_example/templates/description.html.twig
- 4.0.x modules/testing_example/templates/description.html.twig
- 4.0.x modules/tour_example/templates/description.html.twig
- 4.0.x modules/config_entity_example/templates/description.html.twig
- 4.0.x modules/phpunit_example/templates/description.html.twig
- 4.0.x modules/render_example/templates/description.html.twig
- 4.0.x modules/field_permission_example/templates/description.html.twig
- 4.0.x modules/stream_wrapper_example/templates/description.html.twig
- 4.0.x modules/ajax_example/templates/description.html.twig
- 4.0.x modules/hooks_example/templates/description.html.twig
- 4.0.x modules/field_example/templates/description.html.twig
- 4.0.x tests/modules/examples_description_test/templates/description.html.twig
- 4.0.x modules/config_simple_example/templates/description.html.twig
{# Description text for the PHPUnit Example. #} {% set sum_in_hands = path('testing_example.sum_in_hands') %} {% trans %}Testing Frameworks in Drupal
This module provides a path so we can test it. The path takes two numeric arguments, and tells you how many hands are required to count the sum of both numbers.
How to use this example module
You really should be reading the various docblocks in the files under
tests/src/
.How To:
- PHPUnit-based Drupal tests go in the
tests/src
directory, so they will not be loaded by the autoloader during normal bootstrap. - Unit tests go in
[your_module]/tests/src/Unit
. - Kernel tests go in
[your_module]/tests/src/Kernel
. - Functional tests go in
[your_module]/tests/src/Functional
.
Type | Location | Namespace | Subclass of |
Unit test | [your_module]/tests/src/Unit | Drupal\Tests\[your_module]\Unit\ | Drupal\Tests\UnitTestCase |
Kernel test | [your_module]/tests/src/Kernel | Drupal\Tests\[your_module]\Kernel\ | Drupal\KernelTests\KernelTestBase |
Functional test | [your_module]/tests/src/Functional | Drupal\Tests\[your_module]\Functional\ | Drupal\Tests\BrowserTestBase |
FunctionalJavascript test | [your_module]/tests/src/FunctionalJavascript | Drupal\Tests\[your_module]\FunctionalJavascript\ | Drupal\FunctionalJavascriptTests\WebDriverTestBase |
Shared test traits | [your_module]/tests/src/Traits | Drupal\Tests\[your_module]\Traits\ | n/a |
Standard PHPUnit Practices
You can run PHPUnit from the command line or via the run-tests.sh command.
You can specify which type of test you're running via
phpunit --testsuite
and
run-tests.sh --types
.There are many options to phpunit, but, for instance, to run all of the testing_example phpunit tests, you could
{% endtrans %}./vendor/phpunit/phpunit/phpunit -c core/ ./modules/examples/testing_example
File
-
testing_example/
templates/ description.html.twig
View source
- {#
-
- Description text for the PHPUnit Example.
-
- #}
-
- {% set sum_in_hands = path('testing_example.sum_in_hands') %}
-
- {% trans %}
- <h2>Testing Frameworks in Drupal</h2>
-
- <p>This module <a href={{ sum_in_hands }}>provides a path</a> so we can test it.
- The path takes two numeric arguments, and tells you how many hands are
- required to count the sum of both numbers.</p>
-
- <h3>How to use this example module</h3>
- <p>You really should be reading the various docblocks in the files under
- <code>tests/src/</code>.</p>
-
- <h3>How To:</h3>
- <ul>
- <li>PHPUnit-based Drupal tests go in the <code>tests/src</code> directory, so
- they will not be loaded by the autoloader during normal bootstrap.
- </li>
-
- <li>Unit tests go in <code>[your_module]/tests/src/Unit</code>.</li>
- <li>Kernel tests go in <code>[your_module]/tests/src/Kernel</code>.</li>
- <li>Functional tests go in <code>[your_module]/tests/src/Functional</code>.</li>
- </ul>
-
- <table>
- <thead>
- <tr>
- <td><b>Type</b></td>
- <td><b>Location</b></td>
- <td><b>Namespace</b></td>
- <td><b>Subclass of</b></td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Unit test</td>
- <td>[your_module]/tests/src/Unit</td>
- <td>Drupal\Tests\[your_module]\Unit\</td>
- <td>Drupal\Tests\UnitTestCase</td>
- </tr>
- <tr>
- <td>Kernel test</td>
- <td>[your_module]/tests/src/Kernel</td>
- <td>Drupal\Tests\[your_module]\Kernel\</td>
- <td>Drupal\KernelTests\KernelTestBase</td>
- </tr>
- <tr>
- <td>Functional test</td>
- <td>[your_module]/tests/src/Functional</td>
- <td>Drupal\Tests\[your_module]\Functional\</td>
- <td>Drupal\Tests\BrowserTestBase</td>
- </tr>
- <tr>
- <td>FunctionalJavascript test</td>
- <td>[your_module]/tests/src/FunctionalJavascript</td>
- <td>Drupal\Tests\[your_module]\FunctionalJavascript\</td>
- <td>Drupal\FunctionalJavascriptTests\WebDriverTestBase</td>
- </tr>
- <tr>
- <td>Shared test traits</td>
- <td>[your_module]/tests/src/Traits</td>
- <td>Drupal\Tests\[your_module]\Traits\</td>
- <td>n/a</td>
- </tr>
-
- </tbody>
- </table>
-
- <h3>Standard PHPUnit Practices</h3>
- <p>You can run PHPUnit from the command line or via the run-tests.sh command.</p>
- <p>You can specify which type of test you're running via
- <pre><code>phpunit --testsuite</code></pre> and
- <pre><code>run-tests.sh --types</code><pre>.
- <p>There are many options to phpunit, but, for instance, to run all of the
- testing_example phpunit tests, you could
- <pre><code>./vendor/phpunit/phpunit/phpunit -c core/ ./modules/examples/testing_example</code></pre>
- </p>
-
- {% endtrans %}