Skip to content

Commit 7903992

Browse files
Remove content that does not fit into a manual
1 parent 1cbe671 commit 7903992

File tree

5 files changed

+45
-215
lines changed

5 files changed

+45
-215
lines changed

src/annotations.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,8 @@ annotation in a method's DocBlock to mark it as a test method.
737737
########
738738

739739
Specifies an alternative description used when generating the agile
740-
documentation sentences (see :ref:`other-uses-for-tests.agile-documentation`).
740+
documentation sentences.
741+
741742
The ``@testdox`` annotation can be applied to both test classes and test methods.
742743

743744
.. code-block:: php

src/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ Contents:
2323
incomplete-and-skipped-tests
2424
database
2525
test-doubles
26-
testing-practices
2726
code-coverage-analysis
28-
other-uses-for-tests
2927
logging
3028
extending-phpunit
3129

src/other-uses-for-tests.rst

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/testing-practices.rst

Lines changed: 0 additions & 117 deletions
This file was deleted.

src/textui.rst

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ the following code:
235235
``--testdox-html`` and ``--testdox-text``
236236
237237
Generates agile documentation in HTML or plain text format for the
238-
tests that are run. See :ref:`other-uses-for-tests` for
239-
more details.
238+
tests that are run (see :ref:`textui.testdox`).
240239
241240
``--filter``
242241
@@ -459,8 +458,7 @@ the following code:
459458
460459
``--testdox``
461460
462-
Reports the test progress as agile documentation. See
463-
:ref:`other-uses-for-tests` for more details.
461+
Reports the test progress in TestDox format (see :ref:`textui.testdox`).
464462
465463
``--printer``
466464
@@ -506,4 +504,45 @@ the following code:
506504
507505
Please note that as of 4.8, options can be put after the argument(s).
508506
507+
.. _textui.testdox:
508+
509+
TestDox
510+
#######
511+
512+
PHPUnit's TestDox functionality looks at a test class and all the test
513+
method names and converts them from camel case (or snake_case) PHP names to sentences:
514+
``testBalanceIsInitiallyZero()`` (or ``test_balance_is_initially_zero()`` becomes "Balance is
515+
initially zero". If there are several test methods whose names only
516+
differ in a suffix of one or more digits, such as
517+
``testBalanceCannotBecomeNegative()`` and
518+
``testBalanceCannotBecomeNegative2()``, the sentence
519+
"Balance cannot become negative" will appear only once, assuming that
520+
all of these tests succeed.
521+
522+
Let us take a look at the agile documentation generated for a
523+
``BankAccount`` class:
524+
525+
.. code-block:: bash
526+
527+
$ phpunit --testdox BankAccountTest
528+
PHPUnit 7.0.0 by Sebastian Bergmann and contributors.
529+
530+
BankAccount
531+
✔ Balance is initially zero
532+
✔ Balance cannot become negative
533+
534+
Alternatively, the agile documentation can be generated in HTML or plain
535+
text format and written to a file using the ``--testdox-html``
536+
and ``--testdox-text`` arguments.
537+
538+
Agile Documentation can be used to document the assumptions you make
539+
about the external packages that you use in your project. When you use
540+
an external package, you are exposed to the risks that the package will
541+
not behave as you expect, and that future versions of the package will
542+
change in subtle ways that will break your code, without you knowing it.
543+
You can address these risks by writing a test every time you make an
544+
assumption. If your test succeeds, your assumption is valid. If you
545+
document all your assumptions with tests, future releases of the
546+
external package will be no cause for concern: if the tests succeed,
547+
your system should continue working.
509548

0 commit comments

Comments
 (0)