public function ProtectedPrivatesTest::testProtectedAddBadData in Examples for Developers 8
Same name and namespace in other branches
- 3.x modules/phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php \Drupal\Tests\phpunit_example\Unit\ProtectedPrivatesTest::testProtectedAddBadData()
Test ProtectedPrivates::protectedAdd() with bad data using a stub class.
This test is similar to testProtectedAdd(), but expects an exception.
@dataProvider addBadDataProvider
File
- phpunit_example/
tests/ src/ Unit/ ProtectedPrivatesTest.php, line 141
Class
- ProtectedPrivatesTest
- ProtectedPrivates unit testing of restricted methods.
Namespace
Drupal\Tests\phpunit_example\UnitCode
public function testProtectedAddBadData($a, $b) {
$stub = new ProtectedPrivatesSubclass();
$this
->expectException(\InvalidArgumentException::class);
$stub
->subclassProtectedAdd($a, $b);
}