public function ContrivedControllerTest::testAdd in Examples for Developers 8
Same name and namespace in other branches
- 3.x modules/testing_example/tests/src/Unit/Controller/ContrivedControllerTest.php \Drupal\Tests\testing_example\Unit\Controller\ContrivedControllerTest::testAdd()
Test add.
@dataProvider provideTestAdd
File
- testing_example/
tests/ src/ Unit/ Controller/ ContrivedControllerTest.php, line 29
Class
- ContrivedControllerTest
- The class to test ContrivedController.
Namespace
Drupal\Tests\testing_example\Unit\ControllerCode
public function testAdd($expected, $first, $second) {
$controller = $this
->getMockBuilder(ContrivedController::class)
->disableOriginalConstructor()
->getMock();
$ref_add = new \ReflectionMethod($controller, 'add');
$ref_add
->setAccessible(TRUE);
$this
->assertEquals($expected, $ref_add
->invokeArgs($controller, [
$first,
$second,
]));
}