msg Test Page

This is a test page for the functions in the msg.php file. The msg program is a notifcation object that conveys messages from backend processes to the programmer or users. I consider this object to be a global resource that should not be constrained by the class structure.

This test page loads msg.php; then runs it through tests. You can see the msg object and the test in the Source Code Viewer. The results of the tests are below the dotted line

Test Results

These are tests for notifcation functions. The css for message block is in rm.css.

Test a Success Message

The next line checks msgError. As there is no error. It should show "Peform Important Function."

Perform Important Function

Test a failure message

An error occurred. The program is now in a state of general panic; So we skip the important function. The line below should read "Error occurred. Skip Function."

Errors occurred. Skip function.

Test Comment in Debug Mode

In these next tests, I switch the debugMode toggle. The comment jumps out of the HTML and into the comment section.

I added a function called msgToggle. You can wrap it around a function that returns a boolean true or false and a message array. The first element [0] is a success message, the seond [1] is a failure message. The third [2] is a debug comment and fourth action to take if test is not boolean, set to 1. I will call msgToggl with true, false, -1 and "What's a Boolean?"

More Tests

The PDO wrapper sql.php uses the object msg.php to report errors and provides a good example of how msg.php is used.

blog ~ Community Color