function AddClassTest::testAdd

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

Very simple test of AddClass::add().

This is a very simple unit test of a single method. It has a single assertion, and that assertion is probably going to pass. It ignores most of the problems that could arise in the method under test, so therefore: It is not a very good test.

File

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

Class

AddClassTest
AddClass units tests.

Namespace

Drupal\Tests\phpunit_example\Unit

Code

public function testAdd() {
    $sut = new AddClass();
    $this->assertEquals($sut->add(2, 3), 5);
}