function ContrivedControllerTest::testAdd

Same name in other branches
  1. 4.0.x modules/testing_example/tests/src/Unit/Controller/ContrivedControllerTest.php \Drupal\Tests\testing_example\Unit\Controller\ContrivedControllerTest::testAdd()

Test add.

@dataProvider provideTestAdd

File

modules/testing_example/tests/src/Unit/Controller/ContrivedControllerTest.php, line 29

Class

ContrivedControllerTest
The class to test ContrivedController.

Namespace

Drupal\Tests\testing_example\Unit\Controller

Code

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,
    ]));
}