On November 1, 2002 01:08 pm, John Coggeshall wrote: > |What made you decide to go for the OO model of the run-tests > |script, there > |does not seem to be any advantage in adding this overhead (imho)? > > There is most definitely an advantage. Using the OO model, we > essentially created > A "test engine" which had some default output code (direct to stdout) > and ran all of > The desired tests... It basically runs just like the current > run-tests.php script (maybe > Not as many pretty colors, etc). > > The reason the OO is cool though, is when we want to port that test > script into another > Medium or output it in a different format such as HTML. I just created a > new object which > Extended the base class and overload some of the functions (such as > showstatus() which is > Called every time a test passes/fails) to generate HTML output instead > of text..
In the most basic form testing process consists of 4 parts. Executing the script, parsing output, comparing the output to the expected output and comparing the results. Ideally (imho) the process would look something like this pseudo code: function execute_test(test, MODE) { $test_data = init_test(test); $result = run_test(test_script, MODE); $test_output = fetch_test_output($result, MODE); $bool_status = compare_output($test_output, $test_data['expected_output']); return_output($bool_status, $test_data, $test_output, MODE); } The MODE would indicate the mode of operation (cli/cgi/webserver and so on), each step where the MODE is relevant would then have a switch to determine which function should be executed at this point. So, if MODE is cli, we'd run cli_run_test() and similarly if the MODE is web, we'd run web_run_test(). This would make a simpler test, which would not need to rely on more advanced features like OO, which may change in their functionality once ZE2 comes around, as Marcus had pointed out. Since at this point we could have people running both ZE1 and ZE2 use the test, I think relying on OO is dangerous. My reasoning is that considering the simplicity of the testing 'engine', we do not need to add the OO layer of obfuscation. Now, I am not a big fan of OO, so my opinion on the matter maybe somewhat skewed in that regard, non Ilia -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php