Skip to content

Commit 645e58d

Browse files
Nicolas Hartsebastianbergmann
Nicolas Hart
authored andcommitted
Remove the PHPUnit_Extensions_TestDecorator part
fix sebastianbergmann/phpunit-documentation#489
1 parent 7903992 commit 645e58d

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

src/extending-phpunit.rst

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -213,68 +213,6 @@ In :ref:`appendixes.configuration.test-listeners` you can see
213213
how to configure PHPUnit to attach your test listener to the test
214214
execution.
215215

216-
.. _extending-phpunit.PHPUnit_Extensions_TestDecorator:
217-
218-
Subclass PHPUnit_Extensions_TestDecorator
219-
#########################################
220-
221-
You can wrap test cases or test suites in a subclass of
222-
``PHPUnit_Extensions_TestDecorator`` and use the
223-
Decorator design pattern to perform some actions before and after the
224-
test runs.
225-
226-
PHPUnit ships with one concrete test decorator:
227-
``PHPUnit_Extensions_RepeatedTest``. It is used to run a
228-
test repeatedly and only count it as a success if all iterations are
229-
successful.
230-
231-
:numref:`extending-phpunit.examples.RepeatedTest.php`
232-
shows a cut-down version of the ``PHPUnit_Extensions_RepeatedTest``
233-
test decorator that illustrates how to write your own test decorators.
234-
235-
.. code-block:: php
236-
:caption: The RepeatedTest Decorator
237-
:name: extending-phpunit.examples.RepeatedTest.php
238-
239-
<?php
240-
use PHPUnit\Framework\TestCase;
241-
242-
require_once 'PHPUnit/Extensions/TestDecorator.php';
243-
244-
class PHPUnit_Extensions_RepeatedTest extends PHPUnit_Extensions_TestDecorator
245-
{
246-
private $timesRepeat = 1;
247-
248-
public function __construct(PHPUnit\Framework\Test $test, $timesRepeat = 1)
249-
{
250-
parent::__construct($test);
251-
252-
if (is_integer($timesRepeat) &&
253-
$timesRepeat >= 0) {
254-
$this->timesRepeat = $timesRepeat;
255-
}
256-
}
257-
258-
public function count()
259-
{
260-
return $this->timesRepeat * $this->test->count();
261-
}
262-
263-
public function run(PHPUnit\Framework\TestResult $result = null)
264-
{
265-
if ($result === null) {
266-
$result = $this->createResult();
267-
}
268-
269-
for ($i = 0; $i < $this->timesRepeat && !$result->shouldStop(); $i++) {
270-
$this->test->run($result);
271-
}
272-
273-
return $result;
274-
}
275-
}
276-
?>
277-
278216
.. _extending-phpunit.PHPUnit_Framework_Test:
279217

280218
Implement PHPUnit\Framework\Test

0 commit comments

Comments
 (0)