I'm new to PHPUnit. I have php files that don't have any classes in them. What I came to understand from reading documentation, PHPUnit considers a class as a single unit.
So Does PHPUnit considers a class as a unit?
Is it possible to test php files that don't have any class in them?
Sure, you can absolutely test other PHP scripts.
class MyScriptTest extends PHPUnit_Framework_TestCase {
public function testMyFunction() {
include_once 'path/to/script.php';
$result = someFunction();
$this->assertEquals('expected result', $result);
}
}
So write PHPUnit test classes, and inside a test run whatever code you wish to test and make assertions against it.