Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of BrettsBSD.net  >  testThis.class.php  >  test.php  >  Download  
File: test.php
Role: ???
Content type: text/plain
Description: Shows implementation and gives info
Class: testThis.class.php
Author: By
Last change:
Date: 2001-03-29 01:40
Size: 1,867 bytes
 

Contents

Class file image Download
<?
require('testThis.class.php'); // have to use a real require here ;)

// class instantiation
$test = new testThis;

echo '<br>**<strong>File tests</strong>: <br>';
// file include test, set to 2 which just returns false
// $test->includeFile([file],[require level -- determines action],[error message])
$test->includeFile('non-existing-file.file',2,'included file not found<br>');
// file require test, set to 2 which just returns false
// $test->requireFile([file],[require level -- determines action],[error message])
$test->requireFile('non-existing-file.file',2,'required file not found<br>');

$arg1 = 1;
$arg2 = 3;

echo '<br>arg1 = '.$arg1;
echo '<br>arg2 = '.$arg2;

echo '<br><br><strong>Successful tests</strong>: <br>';

echo 'testing constraint: '.$arg2.' == '.$arg2;
//$test->constraint([file],[require level -- determines action],[error message])
$test->constraint($arg2.' == '.$arg2,2,'test failed, level 2 response -- just return false<br>');
echo '<br>Level 2 test passed<br>';

echo 'testing constraint: '.$arg1.' == '.$arg1;
//$test->constraint([file],[require level -- determines action],[error message])
$test->constraint($arg2.' == '.$arg2,1,'test failed, level 1 response -- return false and stop execution of script<br>');
echo '<br>Level 1 test passed<br>';

echo '<br><strong>Failed tests</strong>: <br>';
echo 'testing constraint: '.$arg1.' == '.$arg2;
//$test->constraint([file],[require level -- determines action],[error message])
$test->constraint($arg1.' == '.$arg2,2,'<br>test failed, level 2 response -- just return false<br>');
echo '<br>testing constraint:'.$arg1.' == '.$arg2;
//$test->constraint([file],[require level -- determines action],[error message])
$test->constraint($arg1.' == '.$arg2,1,'<br>test failed, level 1 response -- return false and stop execution of script<br>');

?>