function ProtectedPrivates::privateAdd
Same name in other branches
- 3.x modules/phpunit_example/src/ProtectedPrivates.php \Drupal\phpunit_example\ProtectedPrivates::privateAdd()
A simple addition method with validity checking.
Parameters
int|float $a: A number to add.
int|float $b: Another number to add.
Return value
int|float The sum of $a and $b.
Throws
\InvalidArgumentException If either $a or $b is non-numeric, we can't add, so we throw.
File
-
modules/
phpunit_example/ src/ ProtectedPrivates.php, line 53
Class
- ProtectedPrivates
- A class with features to show how to do unit testing.
Namespace
Drupal\phpunit_exampleCode
private function privateAdd($a, $b) {
$adder = new AddClass();
return $adder->add($a, $b);
}