function ProtectedPrivatesTest::testProtectedAddBadData

Same name in other branches
  1. 8.x-1.x phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php \Drupal\Tests\phpunit_example\Unit\ProtectedPrivatesTest::testProtectedAddBadData()
  2. 4.0.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

modules/phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php, line 141

Class

ProtectedPrivatesTest
ProtectedPrivates unit testing of restricted methods.

Namespace

Drupal\Tests\phpunit_example\Unit

Code

public function testProtectedAddBadData($a, $b) {
    $stub = new ProtectedPrivatesSubclass();
    $this->expectException(\InvalidArgumentException::class);
    $stub->subclassProtectedAdd($a, $b);
}