index.php 15.6 KB
<?php
/**
 * @file	index.inc.php
 * @category freeSN
 * @mailto	code [at] netz.coop
 * @version 0.4.200901
 * @link http://netz.coop
 * 
 *  @copyright Copyright by netz.coop e.G. 2015
 *  
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */


$_LOSP_PATH_TO_ROOT = '../../../../../';

$string  =  '<html>';
$string .=  '<head>';
$string .=  '<title>LOSP => SimpleTests DB|BrowserLayout</title>';
$string .=  '</head>';
$string .=  '<body>';
$string .=  '<h5><a name="anfang">LOSP Test Options</a></h5>';
$string .=  '<form method="post">';
$string .=  ' <td>Zeige Alle Optionen</td>	<td><input type="radio" name="Showoptions" value="TRUE"  /></td>		<td><input type="radio" name="Showoptions" value="FALSE" checked/></td><td>  </td>';
$string .=  '<input type="submit" name="Options" value="Options" />';
$string .=  ' <br><b>Go to: </b> <a href="#allTests"><b><i>Overview</b></i></a> | <a href="#Succesfull">Succesfull</a> | <a href="#Failedassert">Failedassert</a> | <a href="#FailedID">FailedID</a>  | <a href="#NotInTest">Not In Test</a> | <a href="#other">Other</a> ';
require_once('../../../../config.php');
$CONFIG_LOSP_ErrorHandler = false;
$_LOSP_DEV = false;
require_once('./config_ST.php');
require_once( "../../../../../include/System/php/RequireClass.inc.php");
require_once('class_STMANAGEData.inc.php');
require_once '../class_D.inc.php';

$ary_treeParts = CONFIG::getConfig('TreePart');
//D::show($ary_treeParts,'$ary_treeParts',1,1);
$datum = date("d.m.Y");
$uhrzeit = date("H:i");
$string .= '<br>'.$datum." - ".$uhrzeit." Uhr<br>";
/**
 * Shows the hidden Options for the Testsystem
 */

if(!isset ($_POST['ShowMenu'])){
    $_POST['ShowMenu']=TRUE;
}

if($_POST['Showoptions'] === 'TRUE') {
	unset($_POST);
	$string .=  '<b>Options:</b>';
	$string .=	'<table>' .
        '<tr><td>Test</td><td> Yes  </td><td>	No	</td><td></td><td></td></tr>' ;
	$string .='<tr><td>-----------------------------------</td><td>---------- </td><td>---------------	</td><td>----------------------------------------------------------------------------</td><td>------------------------------------</td></tr>' ;
	$string .='<tr bgcolor="#CCFFFF"><td> Test: <b> Profile </b></td>	<td><input type="radio" name="TestreeProfile" value="TRUE"  checked/>		</td>	<td><input type="radio" name="TestreeProfile" value="FALSE"/>				</td><td>   </td><td> </b> </td></tr>' ;
	$class_parents = class_parents('Profile');
	$class_noparents = class_parents('MultimediaText');
	$class_noparents['MultimediaText'] ='MultimediaText';
	$class_parents = array_diff($class_parents, $class_noparents);
	foreach($class_parents as $var_key => $var_value) {
		$string .=  '<tr><td> ------> '.$var_value.'		 </td>	<td><input type="radio" name="TestreeChild'.$var_key.'" value="TRUE"  checked/></td><td><input type="radio" name="TestreeChild'.$var_key.'" value="FALSE"/>	</td><td>   </td><td>  </td></tr>' ;
	}
	foreach($ary_treeParts as $var_key => $var_value) {
		if(!in_array($var_value, $_ST_notTested)){ /** ist wegen Search drinn */
			$string .=  '<tr  bgcolor="#CCFFFF"><td >Test:<b> '.$var_value.'</td>	<td><input type="radio" name="Testree'.$var_key.'" value="TRUE"  checked/></td><td><input type="radio" name="Testree'.$var_key.'" value="FALSE"/></td><td>   </td><td> </b> </td></tr>' ;
			$class_parents = class_parents($var_value);
			$class_noparents = class_parents('MultimediaText');
			$class_noparents['MultimediaText'] ='MultimediaText';
			$class_parents = array_diff($class_parents, $class_noparents);
			foreach($class_parents as $var_key => $var_value) {
				$string .=  '<tr><td>  ------> '.$var_value.'	 </td>	<td><input type="radio" name="TestreeChild'.$var_key.'" value="TRUE"  checked/>	</td><td><input type="radio" name="TestreeChild'.$var_key.'" value="FALSE"/></td><td>   </td><td>  </td></tr>' ;
			}
		}
	}

	$string .=	'	 	<tr><td>-----------------------------------</td><td>---------- 																	</td><td>---------------	</td><td>----------------------------------------------------------------------------</td><td>------------------------------------</td></tr>' .

        '			<tr><td>Tests: </td>	<td>All:			</td>	<td>DB & RegExp:  															</td>	<td>DB: | RegExp: |  Xml: </td><td> Was soll getestet werden</td></tr>' .
        '			<tr><td> |_									</td>	<td><input type="radio" name="wichTests" value="All"  checked/>				</td>	<td><input type="radio" name="wichTests" value="DBExp"  />  </td>	<td><input type="radio" name="wichTests" value="DB"  /> | <input type="radio" name="wichTests" value="Exp"  /> . . . . | <input type="radio" name="wichTests" value="Xml"  />  </td><td> </td></tr>' .

        ' 			<tr><td>-----------------------------------	</td>	<td>---------- 																</td>	<td>---------------	</td><td>----------------------------------------------------------------------------</td><td>------------------------------------</td></tr>' .
        '			<tr><td>Edit								</td>	<td><input type="radio" name="edit" 		value="TRUE"  checked />		</td>	<td><input type="radio" name="edit" 		value="FALSE"/></td>	<td> Zeigt die implementierten & funtionierenden Tests  	</td></tr>' .
        '			<tr><td>Remove (SPAM DB)					</td>	<td><input type="radio" name="remove" 		value="TRUE"  checked />		</td>	<td><input type="radio" name="remove" 		value="FALSE"/>			</td><td> Zeigt die implementierten & funtionierenden Tests  	</td></tr>' .
        ' 			<tr><td>-----------------------------------	</td>	<td>---------- 																</td>	<td>---------------	</td><td>----------------------------------------------------------------------------</td><td>------------------------------------</td></tr>' .

        '			<tr><td>Show GET							</td>	<td><input type="radio" name="ShowGET" value="TRUE"  checked/> 					</td>	<td><input type="radio" name="ShowGET" value="FALSE" />		</td><td> Zeigt den $_GET-Array  </td></tr>' .
        '			<tr><td>Show POST							</td>	<td><input type="radio" name="ShowPOST" value="TRUE" checked/>						</td>	<td><input type="radio" name="ShowPOST" value="FALSE" /> 	</td><td> Zeigt den $_Post-Array  </td></tr>' .
        '			<tr><td>Show ShowTestarray					</td>	<td><input type="radio" name="ShowTestarray" value="TRUE" checked />				</td>	<td><input type="radio" name="ShowTestarray" value="FALSE" /></td><td> Zeigt den Test-Array  </td></tr>' .
        '			<tr><td>Show cURL Output					</td>	<td><input type="radio" name="ShowCurl" value="TRUE" checked />					</td>	<td><input type="radio" name="ShowCurl" value="FALSE" />		</td><td> Zeigt den Output des cURL-Browsers an  </td></tr>' .
        '			<tr><td>Assert Test Rights					</td>	<td><input type="radio" name="AssertRights" value="TRUE"  checked/>			</td>	<td><input type="radio" name="AssertRights" value="FALSE"/>			</td><td>   </td><td>  </td></tr>' .
        '			<tr><td>Show Failed							</td>	<td><input type="radio" name="showFailed" value="TRUE"  checked/>			</td>	<td><input type="radio" name="showFailed" value="FALSE"/>			</td><td>   </td><td>  </td></tr>' .
        '			<tr><td>Test Category						</td>	<td><input type="radio" name="TestCategory" value="TRUE"  checked/>			</td>	<td><input type="radio" name="TestCategory" value="FALSE"/>			</td><td>   </td><td>  </td></tr>' .
        '			<tr><td>Show Tagcloud						</td>	<td><input type="radio" name="TestTagcloud" value="TRUE"  checked/>			</td>	<td><input type="radio" name="TestTagcloud" value="FALSE"/>			</td><td>   </td><td>  </td></tr>' .
        '			<tr><td>Show other Output						</td>	<td><input type="radio" name="showotheroutput" value="TRUE" />			</td>	<td><input type="radio" name="showotheroutput" value="FALSE" checked/>			</td><td>   </td><td>  </td></tr>' .
     //   '			<tr><td>Error Reporting                                                 </td>	<td><input type="radio" name="errorreporting" value="TRUE" />			</td>	<td><input type="radio" name="errorreporting" value="FALSE" checked/>			</td><td> False unterdrückt Notices!  </td><td>  </td></tr>' .
        '			<tr><td>Error Reporting: </td>	<td>Turn off error report  ||             </td><td>   	Running Errors		||	</td>	<td>   Running Errors + notices ||</td><td>All errors except notices + warnings || </td><td>All errors except notices ||</td><td>All errors </td></tr>' .
        '			<tr><td> |_									</td>	<td><input type="radio" name="errorreporting" value="0"  checked/>				</td>	<td><input type="radio" name="errorreporting" value="1"  />	<td><input type="radio" name="errorreporting" value="2"  />  </td>	<td><input type="radio" name="errorreporting" value="3"  />|  	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp;  	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp; 	&nbsp;                <input type="radio" name="errorreporting" value="4"  />    |   <input type="radio" name="errorreporting" value="5"  />  </td><td> </td></tr>' .
        '
                                <tr><td>-----------------------------------	</td>	<td>---------- 																</td>	<td>---------------	</td><td>----------------------------------------------------------------------------</td><td>------------------------------------</td></tr>' .


        '	</table>' ;

	$_POST['ShowMenu']='X';
}else if($_POST['ShowMenu'] !=='X') {
	$_POST['ShowMenu']='X';
	if($_ST_testPar) {
		$_POST=$_ST_testPar;
	}
}
$string .=  '<input type="submit" name="Submit" value="Start" />';
$string .=  '</form>';
$string .=  '</body>';
$string .=  '</html>';
header('Content-Type: text/html; charset=utf-8');
echo $string;
/**
 * $_POST defaults:
 */
//print_r($_ST_cfgStd);
if($_POST['Submit']=='Start') {
	if(!$_POST['wichTests']) {
		$_POST['wichTests'] ='All';
	}
	if(!$_POST['remove']) {
		$_POST['remove'] ='TRUE';
	}
	if(!$_POST['ShowGET']) {
		$_POST['ShowGET'] ='TRUE';
	}
	if(!$_POST['ShowPOST']) {
		$_POST['ShowPOST'] ='TRUE';
	}
	if(!$_POST['ShowTestarray']) {
		$_POST['ShowTestarray'] ='TRUE';
	}
	if(!$_POST['ShowCurl']) {
		$_POST['ShowCurl'] ='TRUE';
	}
	if(!$_POST['AssertRights']) {
		$_POST['AssertRights'] ='TRUE';
	}
	if(!$_POST['showFailed']) {
		$_POST['showFailed'] ='TRUE';
	}
	if(!$_POST['TestCategory']) {
		$_POST['TestCategory'] ='TRUE';
	}
	if(!$_POST['TestTagcloud']) {
		$_POST['TestTagcloud'] ='TRUE';
	}
        if(!$_POST['showotheroutput']) {
		$_POST['showotheroutput'] ='FALSE';
	}
        if(!$_POST['errorreporting'] ){
            $_POST['errorreporting']= ($_ST_cfgStd['error_reporting_level']);
        }

	STMANAGEData::setnotInTagcloud($_ST_notInTagcloud);
	STMANAGEData::setnotInCategory($_ST_notInCategory);
	STMANAGEData::setnotInRightsTest($_ST_notInRightsTest);
	STMANAGEData::setGenCfgSTStd($_ST_cfgStd);
	STMANAGEData::setTestPar($_POST);
	STMANAGEData::setTestPathIn($_COOKIEPATH,'Cookie');
	STMANAGEData::setTestPathIn($_LOGPATH,'Logpath');
	STTREEHelpers::$varCountMax = $_ST_testDepth['x'];
	STTREEHelpers::$varDepthMax =$_ST_testDepth['y'];

	$param = array('LSData'=> $_LOSP_STORABLE_DATA,'STnTested'=>$_ST_notTested,'STnTestedremove'=>$_LOSP_STORABLE_DATA);
	//	$STTree = new STAll($_LOSP_STORABLE_DATA,$_ST_notTested,$_ST_notTested_remove);
	$STTree = new STAll($param);
	$STTree->run(new HtmlReporter());
	$array_getTests= $STTree->getTests();

	echo '<br><font style=\"color:red\"> <b>Totaltime:</b> </font>'.TimeTools::$totaltime['minutes'].' min '.TimeTools::$totaltime['seconds'].' sec <br>';
	echo '<br><font style=\"color:red\">  <b>Totaltests: </b> DB </font>'.TimeTools::$DBtotaltests.'; RegExp '.TimeTools::$RegExptotaltests.'; XML '.TimeTools::$Xmltotaltests .' <br>';
	$array_time_warn= STMANAGEData::getGenCfgSTStd('0');
	echo '<br><font style=\"color:red\">  <b>Times  </b>(Config): Notice </font>'.$array_time_warn['timetools']['notice'].' sec ; Warning '.$array_time_warn['timetools']['warn'].' sec ; Alert '.$array_time_warn['timetools']['alert'] .' sec<br>';
	if(TimeTools::$DBFails ==='Failed') {
		echo '<br><h2><font style=\"color:red\"> Database: Simple Test error<br></h2></font>';
	}
	if(TimeTools::$RegExpFails ==='Failed') {
		echo '<br><h2><font style=\"color:red\"> Browser: Simple Test error<br></h2></font>';
	}
	if(TimeTools::$XmlFails ==='Failed') {
		echo '<br><h2><font style=\"color:red\"> Xml: Simple Test error<br></h2></font>';
	}
	D::show(TimeTools::$array_allert_tests,'Time Alert Tests',1,1);


	D::show(STMANAGEData::getAllTests(),' ',true,true);
	echo '<pre><a name="Succesfull"><h3>Succesfull </h3></a></pre>';
	echo  '<br><b>Go to: </b> <a href="#anfang">Anfang</a> | <a href="#allTests">Overview</a> | <a href="#Succesfull">Succesfull</a> | <a href="#Failedassert">Failedassert</a> | <a href="#FailedID">FailedID</a> | <a href="#NotInTest">Not In Test</a>| <a href="#other">Other</a> ';

	SendReceiveTools::trsfmWalkArrayToLink('Success');
	SendReceiveTools::trsfmWalkArrayToLink('FailDB');
	SendReceiveTools::trsfmWalkArrayToLink('FailAssert');
	D::show(SendReceiveTools::$ary_link,'Succesfull',1,1);
	echo '<pre><a name="Failedassert"><h3>Failed assert </h3></a></pre>';
	echo  ' <br><b>Go to: </b> <a href="#anfang">Anfang</a> | <a href="#allTests">Overview</a> | <a href="#Succesfull">Succesfull</a> | <a href="#Failedassert">Failedassert</a> | <a href="#FailedID">FailedID</a> | <a href="#NotInTest">Not In Test</a>| <a href="#other">Other</a> ';

	D::show(SendReceiveTools::$ary_linkFailAssert,'Failed assert simpletests',1,1);
	echo '<pre><a name="FailedID"><h3>Failed to get ID </h3></a></pre>';
	echo  ' <br><b>Go to: </b><a href="#anfang">Anfang</a> | <a href="#allTests">Overview</a> | <a href="#Succesfull">error_reporting(E_ERROR | E_WARNING | E_PARSE);Succesfull</a> | <a href="#Failedassert">Failedassert</a> | <a href="#FailedID">FailedID</a> | <a href="#NotInTest">Not In Test</a>| <a href="#other">Other</a> ';

	D::show(SendReceiveTools::$ary_linkFailDB,'Failed get ID from DB',1,1);
	echo '<pre><a name="NotInTest"><h3>Not In Test </h3></a></pre>';
	echo  ' <br><b>Go to: </b><a href="#anfang">Anfang</a> | <a href="#allTests">Overview</a> | <a href="#Succesfull">Succesfull</a> | <a href="#Failedassert">Failedassert</a> | <a href="#FailedID">FailedID</a> | <a href="#NotInTest">Not In Test</a>| <a href="#other">Other</a> ';

	D::show(STTree::$ary_walkFncNotTested,'Not In Test',true,true);

	echo '<pre><a name="other"><h3>Other: </h3></a></pre>';
	echo  ' <br><b>Go to: </b><a href="#anfang">Anfang</a> | <a href="#allTests">Overview</a> | <a href="#Succesfull">Succesfull</a> | <a href="#Failedassert">Failedassert</a> | <a href="#FailedID">FailedID</a> | <a href="#NotInTest">Not In Test</a>';
	echo '';
	echo '<br>';
	$ary_succ = FileTools::$ary_succesfullLinks;
	foreach($ary_succ as $var_key => $var_value) {
		if($var_key === 0){
			echo '<h2>';
			echo $var_value;
			echo '</h2>';
			echo '<br>';
		}else{
			echo $var_value;
		}
	}
	echo ' <br><b>Full Tree object numbers for each level:</b><br>';
	sort(STTREEHelpers::$ary_treeCountPlanes);
	$ary_treeCount = STTREEHelpers::$ary_treeCountPlanes;
	foreach ($ary_treeCount as $var_key => $var_value) {
		echo 'Level: ';
		echo $var_key+1 .' Objects: '.$var_value.'<br>';
	}
	echo '<br> in Testsystem:<br>';
	$ary_treeCounttested = STTree::$ary_treeCountPlanestested;
	foreach ($ary_treeCounttested as $var_key => $var_value) {
		echo 'Level: ';
		echo $var_key .' Objects: '.$var_value.'<br>';
	}

	print_r($array_getTests);

}

?>