How does PHPUnit differ from functional testing tools like Selenium and Behat?

PHPUnit is a unit testing framework for PHP, focusing on testing individual units or components of code in isolation. It is used to test classes, methods, and functions to ensure they work as expected. On the other hand, tools like Selenium and Behat are functional testing tools that focus on testing the application as a whole, including interactions between different components and user interfaces.

// PHPUnit example
class MathTest extends \PHPUnit\Framework\TestCase {
    public function testAddition() {
        $math = new Math();
        $result = $math->add(2, 3);
        $this->assertEquals(5, $result);
    }
}