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 testing_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 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. #} {% trans %}PHPUnit for Drupal: A very basic how-to.
How to use this example module
You really should be reading the various docblocks in the test files.
How To:
PHPUnit tests belong in their own directory, so they won't be loaded by the autoloader during normal bootstrap. This means you should have a
/tests/src
directory in the root of your module directory.Your tests should be in the
Drupal\Tests\[your_module]\Unit
namespace. Under Drupal's PSR-4 system, this means your PHPUnit-based tests should go in a[your_module]/tests/src/Unit
directory.Your test case should subclass
Drupal\Tests\UnitTestCase
.-
You can run PHPUnit-based tests from within Drupal 8 by enabling the Testing module and then selecting the PHPUnit group from the testing page. As of this writing, this method doesn't provide any useful output.
Standard PHPUnit Practices
You can (and really, should) run PHPUnit from the command line.
On unix-based systems this means you need to cd core
and then
./vendor/bin/phpunit
On Windows-based systems, assuming you have php in your path,
php ./vendor/phpunit/phpunit/composer/bin/phpunit --group phpunit_example
Also, you should mark your tests as belonging to a group, so they can be run
independently. You do this by annotating your test classes with
@group group_name
. You should have a @group
for
your module name, and you should also have a @group
for
integrations, such as views
.
So, for instance, to run all of the PHPUnit example tests, you would type
./vendor/bin/phpunit --group phpunit_example
As you can see, including a @group
annotation is a good idea.
File
-
phpunit_example/
templates/ description.html.twig
View source
- {#
-
- Description text for the PHPUnit Example.
-
- #}
-
- {% trans %}
- <h2>PHPUnit for Drupal: A very basic how-to.</h2>
-
- <h3>How to use this example module</h3>
- <p>You really should be reading the various docblocks in the test files.</p>
-
- <h3>How To:</h3>
- <ul>
- <li><p>PHPUnit tests belong in their own directory, so they won't be loaded
- by the autoloader during normal bootstrap. This means you should have a
- <code>/tests/src</code> directory in the root of your module directory.</p>
- </li>
-
- <li><p>Your tests should be in the <code>Drupal\Tests\[your_module]\Unit</code>
- namespace. Under Drupal's PSR-4 system, this means your PHPUnit-based
- tests should go in a <code>[your_module]/tests/src/Unit</code>
- directory.</p>
- </li>
- <li><p>Your test case should subclass <code>Drupal\Tests\UnitTestCase</code>.
- </p>
- </li>
- <li>
- <p>You can run PHPUnit-based tests from within Drupal 8 by enabling the
- Testing module and then selecting the PHPUnit group from the testing page.
- As of this writing, this method doesn't provide any useful output.
- </p>
- </li>
- </ul>
-
- <h3>Standard PHPUnit Practices</h3>
- <p>You can (and really, should) run PHPUnit from the command line.</p>
- <p>On unix-based systems this means you need to <code>cd core</code> and then
- <pre><code>./vendor/bin/phpunit</code></pre>
- </p>
- <p>On Windows-based systems, assuming you have php in your path,
- <pre><code>php ./vendor/phpunit/phpunit/composer/bin/phpunit --group phpunit_example</code></pre>
- </p>
- <p>Also, you should mark your tests as belonging to a group, so they can be run
- independently. You do this by annotating your test classes with
- <code>@group group_name</code>. You should have a <code>@group</code> for
- your module name, and you should also have a <code>@group</code> for
- integrations, such as <code>views</code>.
- </p>
- <p>So, for instance, to run all of the PHPUnit example tests, you would type
- <pre><code>./vendor/bin/phpunit --group phpunit_example</code></pre>
- </p>
- <p>As you can see, including a <code>@group</code> annotation is a good idea.</p>
-
- {% endtrans %}