Add HamcrestPHPUnitIntegration trait
authorKunal Mehta <legoktm@member.fsf.org>
Fri, 13 Apr 2018 02:52:05 +0000 (19:52 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Fri, 13 Apr 2018 02:52:05 +0000 (19:52 -0700)
commit1a2ef3555903dcaab909cd9a5b8a3e60a319da94
tree72e1b4f9c4a9a74f3ad568c93cd24d889165e844
parent693e9b2728d910c3c32affd2013f755fe22e03e3
Add HamcrestPHPUnitIntegration trait

Hamcrest has its own assertThat() function, which is used in PHPUnit
tests. However, in PHPUnit 6, tests that don't have any assertions are
marked as risky.

To work around that, add a HamcrestPHPUnitIntegration trait that
provides a $this->assertThatHamcrest() - it wraps around Hamcrest's
assertThat(), and increments PHPUnit's assertion counter, so using it
ensures that the test is not risky.

Change-Id: Ia4a4ec226f64ebe90d1091ffd27420a356ca76ff
tests/common/TestsAutoLoader.php
tests/phpunit/HamcrestPHPUnitIntegration.php [new file with mode: 0644]