description.html.twig

Same filename in this branch
  1. 8.x-1.x menu_example/templates/description.html.twig
  2. 8.x-1.x form_api_example/templates/description.html.twig
  3. 8.x-1.x js_example/templates/description.html.twig
  4. 8.x-1.x page_example/templates/description.html.twig
  5. 8.x-1.x node_type_example/templates/description.html.twig
  6. 8.x-1.x pager_example/templates/description.html.twig
  7. 8.x-1.x block_example/templates/description.html.twig
  8. 8.x-1.x tabledrag_example/templates/description.html.twig
  9. 8.x-1.x testing_example/templates/description.html.twig
  10. 8.x-1.x tour_example/templates/description.html.twig
  11. 8.x-1.x config_entity_example/templates/description.html.twig
  12. 8.x-1.x tests/modules/examples_description_test/templates/description.html.twig
  13. 8.x-1.x render_example/templates/description.html.twig
  14. 8.x-1.x field_permission_example/templates/description.html.twig
  15. 8.x-1.x stream_wrapper_example/templates/description.html.twig
  16. 8.x-1.x ajax_example/templates/description.html.twig
  17. 8.x-1.x hooks_example/templates/description.html.twig
  18. 8.x-1.x field_example/templates/description.html.twig
Same filename in other branches
  1. 3.x modules/menu_example/templates/description.html.twig
  2. 3.x modules/form_api_example/templates/description.html.twig
  3. 3.x modules/js_example/templates/description.html.twig
  4. 3.x modules/page_example/templates/description.html.twig
  5. 3.x modules/node_type_example/templates/description.html.twig
  6. 3.x modules/pager_example/templates/description.html.twig
  7. 3.x modules/block_example/templates/description.html.twig
  8. 3.x modules/tabledrag_example/templates/description.html.twig
  9. 3.x modules/rest_example/templates/description.html.twig
  10. 3.x modules/testing_example/templates/description.html.twig
  11. 3.x modules/tour_example/templates/description.html.twig
  12. 3.x modules/config_entity_example/templates/description.html.twig
  13. 3.x modules/phpunit_example/templates/description.html.twig
  14. 3.x modules/render_example/templates/description.html.twig
  15. 3.x modules/field_permission_example/templates/description.html.twig
  16. 3.x modules/stream_wrapper_example/templates/description.html.twig
  17. 3.x modules/ajax_example/templates/description.html.twig
  18. 3.x modules/hooks_example/templates/description.html.twig
  19. 3.x modules/field_example/templates/description.html.twig
  20. 3.x tests/modules/examples_description_test/templates/description.html.twig
  21. 4.0.x modules/menu_example/templates/description.html.twig
  22. 4.0.x modules/form_api_example/templates/description.html.twig
  23. 4.0.x modules/js_example/templates/description.html.twig
  24. 4.0.x modules/page_example/templates/description.html.twig
  25. 4.0.x modules/node_type_example/templates/description.html.twig
  26. 4.0.x modules/pager_example/templates/description.html.twig
  27. 4.0.x modules/block_example/templates/description.html.twig
  28. 4.0.x modules/tabledrag_example/templates/description.html.twig
  29. 4.0.x modules/rest_example/templates/description.html.twig
  30. 4.0.x modules/testing_example/templates/description.html.twig
  31. 4.0.x modules/tour_example/templates/description.html.twig
  32. 4.0.x modules/config_entity_example/templates/description.html.twig
  33. 4.0.x modules/phpunit_example/templates/description.html.twig
  34. 4.0.x modules/render_example/templates/description.html.twig
  35. 4.0.x modules/field_permission_example/templates/description.html.twig
  36. 4.0.x modules/stream_wrapper_example/templates/description.html.twig
  37. 4.0.x modules/ajax_example/templates/description.html.twig
  38. 4.0.x modules/hooks_example/templates/description.html.twig
  39. 4.0.x modules/field_example/templates/description.html.twig
  40. 4.0.x tests/modules/examples_description_test/templates/description.html.twig
  41. 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.

{% endtrans %}

File

phpunit_example/templates/description.html.twig

View source
  1. {#
  2. Description text for the PHPUnit Example.
  3. #}
  4. {% trans %}
  5. <h2>PHPUnit for Drupal: A very basic how-to.</h2>
  6. <h3>How to use this example module</h3>
  7. <p>You really should be reading the various docblocks in the test files.</p>
  8. <h3>How To:</h3>
  9. <ul>
  10. <li><p>PHPUnit tests belong in their own directory, so they won&#39;t be loaded
  11. by the autoloader during normal bootstrap. This means you should have a
  12. <code>/tests/src</code> directory in the root of your module directory.</p>
  13. </li>
  14. <li><p>Your tests should be in the <code>Drupal\Tests\[your_module]\Unit</code>
  15. namespace. Under Drupal&#39;s PSR-4 system, this means your PHPUnit-based
  16. tests should go in a <code>[your_module]/tests/src/Unit</code>
  17. directory.</p>
  18. </li>
  19. <li><p>Your test case should subclass <code>Drupal\Tests\UnitTestCase</code>.
  20. </p>
  21. </li>
  22. <li>
  23. <p>You can run PHPUnit-based tests from within Drupal 8 by enabling the
  24. Testing module and then selecting the PHPUnit group from the testing page.
  25. As of this writing, this method doesn&#39;t provide any useful output.
  26. </p>
  27. </li>
  28. </ul>
  29. <h3>Standard PHPUnit Practices</h3>
  30. <p>You can (and really, should) run PHPUnit from the command line.</p>
  31. <p>On unix-based systems this means you need to <code>cd core</code> and then
  32. <pre><code>./vendor/bin/phpunit</code></pre>
  33. </p>
  34. <p>On Windows-based systems, assuming you have php in your path,
  35. <pre><code>php ./vendor/phpunit/phpunit/composer/bin/phpunit --group phpunit_example</code></pre>
  36. </p>
  37. <p>Also, you should mark your tests as belonging to a group, so they can be run
  38. independently. You do this by annotating your test classes with
  39. <code>@group group_name</code>. You should have a <code>@group</code> for
  40. your module name, and you should also have a <code>@group</code> for
  41. integrations, such as <code>views</code>.
  42. </p>
  43. <p>So, for instance, to run all of the PHPUnit example tests, you would type
  44. <pre><code>./vendor/bin/phpunit --group phpunit_example</code></pre>
  45. </p>
  46. <p>As you can see, including a <code>@group</code> annotation is a good idea.</p>
  47. {% endtrans %}