What is the best approach to testing functions that do not have a return value in PHP?

When testing functions in PHP that do not have a return value, the best approach is to use assertions to check if the function has performed the desired side effects. This can include checking if variables have been modified, if certain functions have been called, or if specific conditions have been met within the function.

<?php

// Function to test
function updateVariable(&$var, $newValue) {
    $var = $newValue;
}

// Test case using assertions
$testVar = 5;
updateVariable($testVar, 10);

assert($testVar == 10, "Variable was not updated correctly");

echo "Test passed successfully\n";