public function ProtectedPrivatesTest::testProtectedAddBadData in Examples for Developers 3.x
Same name and namespace in other branches
- 8 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
- modules/
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);
}