Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 0570510

Browse files
Nicolas Hartm-takagi
Nicolas Hart
authored andcommitted
Remove the deprecated PHPUnit_Extensions_TestDecorator part
1 parent 2e27286 commit 0570510

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

src/extending-phpunit.rst

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -211,69 +211,6 @@ PHPUnit\\Framework\\TestListener の実装
211211
に、自作のテストリスナーをテスト実行時にアタッチするための
212212
PHPUnit の設定方法についての説明があります。
213213

214-
.. _extending-phpunit.PHPUnit_Extensions_TestDecorator:
215-
216-
PHPUnit_Extensions_TestDecorator のサブクラスの作成
217-
##########################################
218-
219-
``PHPUnit_Extensions_TestDecorator``
220-
のサブクラスでテストケースあるいはテストスイートをラッピングし、
221-
デコレータパターンを使用することで
222-
各テストの実行前後に何らかの処理をさせることができます。
223-
224-
PHPUnit には、``PHPUnit_Extensions_RepeatedTest``
225-
および ``PHPUnit_Extensions_TestSetup``
226-
という 2 つの具象テストデコレータが付属しています。
227-
前者はテストを繰り返し実行し、それらが全て成功した場合にのみ成功とみなします。
228-
後者については :ref:`fixtures` で説明しました。
229-
230-
:numref:`extending-phpunit.examples.RepeatedTest.php`
231-
は、テストデコレータ ``PHPUnit_Extensions_RepeatedTest``
232-
の一部を抜粋したものです。独自のデコレータを作成するための参考にしてください。
233-
234-
.. code-block:: php
235-
:caption: RepeatedTest デコレータ
236-
:name: extending-phpunit.examples.RepeatedTest.php
237-
238-
<?php
239-
use PHPUnit\Framework\TestCase;
240-
241-
require_once 'PHPUnit/Extensions/TestDecorator.php';
242-
243-
class PHPUnit_Extensions_RepeatedTest extends PHPUnit_Extensions_TestDecorator
244-
{
245-
private $timesRepeat = 1;
246-
247-
public function __construct(PHPUnit\Framework\Test $test, $timesRepeat = 1)
248-
{
249-
parent::__construct($test);
250-
251-
if (is_integer($timesRepeat) &&
252-
$timesRepeat >= 0) {
253-
$this->timesRepeat = $timesRepeat;
254-
}
255-
}
256-
257-
public function count()
258-
{
259-
return $this->timesRepeat * $this->test->count();
260-
}
261-
262-
public function run(PHPUnit\Framework\TestResult $result = null)
263-
{
264-
if ($result === null) {
265-
$result = $this->createResult();
266-
}
267-
268-
for ($i = 0; $i < $this->timesRepeat && !$result->shouldStop(); $i++) {
269-
$this->test->run($result);
270-
}
271-
272-
return $result;
273-
}
274-
}
275-
?>
276-
277214
.. _extending-phpunit.PHPUnit_Framework_Test:
278215

279216
PHPUnit\Framework\Test の実装

0 commit comments

Comments
 (0)