This repository was archived by the owner on Jan 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +0
-42
lines changed Expand file tree Collapse file tree 1 file changed +0
-42
lines changed Original file line number Diff line number Diff line change @@ -677,48 +677,6 @@ PHPUnit はテストが実行される順序を変更しないので、
677
677
``$expected `` のメッセージが含まれるかどうかを確かめるだけのものであり、
678
678
完全一致するかどうかを確かめるわけではないことに注意しましょう。
679
679
680
- 別の方法として、``@expectedException ``、
681
- ``@expectedExceptionCode ``、
682
- ``@expectedExceptionMessage ``、
683
- ``@expectedExceptionMessageRegExp `` といったアノテーションでも、
684
- テスト対象のコードで発生するであろう例外をテストできます。
685
- :numref: `writing-tests-for-phpunit.exceptions.examples.ExceptionTest2.php `
686
- に例を示します。
687
-
688
- .. code-block :: php
689
- :caption: @expectedException アノテーションの使用法
690
- :name: writing-tests-for-phpunit.exceptions.examples.ExceptionTest2.php
691
-
692
- <?php
693
- use PHPUnit\Framework\TestCase;
694
-
695
- class ExceptionTest extends TestCase
696
- {
697
- /**
698
- * @expectedException InvalidArgumentException
699
- */
700
- public function testException()
701
- {
702
- }
703
- }
704
-
705
- .. code-block :: bash
706
-
707
- $ phpunit ExceptionTest
708
- PHPUnit | version| .0 by Sebastian Bergmann and contributors.
709
-
710
- F
711
-
712
- Time: 0 seconds, Memory: 4.75Mb
713
-
714
- There was 1 failure:
715
-
716
- 1) ExceptionTest::testException
717
- Failed asserting that exception of type " InvalidArgumentException" is thrown.
718
-
719
- FAILURES!
720
- Tests: 1, Assertions: 1, Failures: 1.
721
-
722
680
.. _writing-tests-for-phpunit.errors :
723
681
724
682
PHP のエラーのテスト
You can’t perform that action at this time.
0 commit comments