PHPUnit 6から9の主な変更点
(最終更新:2021-03-05)
この記事は PHP その2 Advent Calendar 2020 - Qiita の17日目です。まだ、空きがありますので、興味のある方は気軽に参加してください。
PHPUnit、どんどんバージョンがあがってしまい、変更点がよくわからないので、まとめてみました。
PHPUnit 6
- 2019/02/08 まで保守(EOL)
6.0
- PHP 7.0 以上が必要
- 名前空間
setUp()が@beforeの後に実行setUpBeforeClass()が@beforeClassの後に実行backupGlobals="false"に- 廃止
--log-json--tapgetMock()setExpectedException()setExpectedExceptionRegExp()
6.2
@runClassInSeparateProcess追加
6.4
--list-tests追加
PHPUnit 7
- 2020/02/07 まで保守(EOL)
7.0
- PHP 7.1 以上が必要
- PHP 7.0 のサポート廃止
7.3
--order-by追加--order-by=random--order-by=depends--order-by=reverse
7.5
- 追加
assertEqualsCanonicalizing()assertEqualsIgnoringCase()assertEqualsWithDelta()assertIsArray()assertIsBool()assertIsFloat()assertIsInt()assertIsObject()assertIsString()assertStringContainsString()assertStringContainsStringIgnoringCase()
PHPUnit 8
- 2021/02/05 まで保守
8.0
- PHP 7.2 以上が必要
- PHP 7.1 のサポート廃止
8.3
- 追加
MockBuilder::addMethods()MockBuilder::onlyMethods()
8.4
TestCase::createStub()追加
8.5
- Xdebug 3 のサポート
- 追加
assertFileEqualsCanonicalizing()assertFileEqualsIgnoringCase()assertStringEqualsFileCanonicalizing()assertStringEqualsFileIgnoringCase()
PHPUnit 9
- 2022/02/04 まで保守
9.0
- PHP 7.3 以上が必要
- PHP 7.2 のサポート廃止
- 廃止
@expectedException*expectExceptionMessageRegExp()assertAttribute*()assertInternalType()assertEquals()のオプションパラメータ
MockBuilder::setMethods()が廃止予定
9.1
- 追加
assertIsNotReadable()assertIsNotWritable()assertDirectoryDoesNotExist()assertFileDoesNotExist()assertMatchesRegularExpression()assertDoesNotMatchRegularExpression()
9.2
- テストダブルのコード生成で Union Type をサポート
9.3
- PHP 8 のサポート
- phpunit.xml でのコードカバレッジとロギング設定の変更
- blacklist/whitelist の変更
PHPUnit\Util\ExcludeList追加PHPUnit\Util\Blacklist廃止予定TestCase::$backupGlobalsExcludeList追加TestCase::$backupGlobalsBlacklist廃止予定TestCase::$backupStaticAttributesExcludeList追加TestCase::$backupStaticAttributesBlacklist廃止予定--coverage-filter <directory>追加--whitelist <directory>廃止予定
- パスカバレッジのサポート
pathCoverage属性--path-coverageオプション
この記事は PHP その2 Advent Calendar 2020 - Qiita の17日目です。まだ、空きがありますので、興味のある方は気軽に参加してください。
関連
参考
PHPUnit6
- https://phpunit.de/announcements/phpunit-6.html
- https://github.com/sebastianbergmann/phpunit/blob/6.0.13/ChangeLog-6.0.md
- https://github.com/sebastianbergmann/phpunit/blob/6.1.4/ChangeLog-6.1.md
- https://github.com/sebastianbergmann/phpunit/blob/6.2.4/ChangeLog-6.2.md
- https://github.com/sebastianbergmann/phpunit/blob/6.3.1/ChangeLog-6.3.md
- https://github.com/sebastianbergmann/phpunit/blob/6.4.4/ChangeLog-6.4.md
- https://github.com/sebastianbergmann/phpunit/blob/6.5.14/ChangeLog-6.5.md
PHPUnit7
- https://phpunit.de/announcements/phpunit-7.html
- https://github.com/sebastianbergmann/phpunit/blob/7.0.3/ChangeLog-7.0.md
- https://github.com/sebastianbergmann/phpunit/blob/7.1.5/ChangeLog-7.1.md
- https://github.com/sebastianbergmann/phpunit/blob/7.2.7/ChangeLog-7.2.md
- https://github.com/sebastianbergmann/phpunit/blob/7.3.5/ChangeLog-7.3.md
- https://github.com/sebastianbergmann/phpunit/blob/7.4.5/ChangeLog-7.4.md
- https://github.com/sebastianbergmann/phpunit/blob/7.5.20/ChangeLog-7.5.md
PHPUnit8
- https://phpunit.de/announcements/phpunit-8.html
- https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md
- https://github.com/sebastianbergmann/phpunit/blob/8.1.6/ChangeLog-8.1.md
- https://github.com/sebastianbergmann/phpunit/blob/8.2.5/ChangeLog-8.2.md
- https://github.com/sebastianbergmann/phpunit/blob/8.3.5/ChangeLog-8.3.md
- https://github.com/sebastianbergmann/phpunit/blob/8.4.3/ChangeLog-8.4.md
- https://github.com/sebastianbergmann/phpunit/blob/8.5.14/ChangeLog-8.5.md
PHPUnit9
- https://phpunit.de/announcements/phpunit-9.html
- https://github.com/sebastianbergmann/phpunit/blob/9.0.2/ChangeLog-9.0.md
- https://github.com/sebastianbergmann/phpunit/blob/9.1.5/ChangeLog-9.1.md
- https://github.com/sebastianbergmann/phpunit/blob/9.2.6/ChangeLog-9.2.md
- https://github.com/sebastianbergmann/phpunit/blob/9.3.11/ChangeLog-9.3.md
- https://github.com/sebastianbergmann/phpunit/blob/9.4.4/ChangeLog-9.4.md
- https://github.com/sebastianbergmann/phpunit/blob/9.5.2/ChangeLog-9.5.md
Date: 2020/12/17



![徹底攻略PHP5技術者認定[上級]試験問題集 [PJ0-200]対応 徹底攻略PHP5技術者認定[上級]試験問題集 [PJ0-200]対応](http://tatsu-zine.com/images/books/164/cover_s.jpg)

