function AddClassTest::addDataProvider

Same name in other branches
  1. 3.x modules/phpunit_example/tests/src/Unit/AddClassTest.php \Drupal\Tests\phpunit_example\Unit\AddClassTest::addDataProvider()

Data provider for testAddWithDataProvider().

Data provider methods take no arguments and return an array of data to use for tests. Each element of the array is another array, which corresponds to the arguments in the test method's signature.

Note also that PHPUnit tries to run tests using methods that begin with 'test'. This means that data provider method names should not begin with 'test'. Also, by convention, they should end with 'DataProvider'.

Return value

array Nested arrays of values to check:

  • $a
  • $b
  • $expected

See also

self::testAddWithDataProvider()

File

modules/phpunit_example/tests/src/Unit/AddClassTest.php, line 138

Class

AddClassTest
AddClass units tests.

Namespace

Drupal\Tests\phpunit_example\Unit

Code

public function addDataProvider() {
    return [
        [
            5,
            2,
            3,
        ],
        [
            50,
            20,
            30,
        ],
    ];
}