Location: PHPKode > scripts > HostingBenchmark > hostingbenchmark/tests/AbstractTest.php
<?php

/***************************************************************
*  (c) 2006-2007 Askywhale (hosting[a]askywhale.com)
*  All rights reserved
*
*  This script is part of HostingBenchmark.com. This project 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 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*  A copy is found in the textfile GPL.txt and important notices to the license
*  from the author is found in LICENSE.txt distributed with these scripts.
*
*  This script 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.
***************************************************************/

define('OK_STR',"All correct");
define('ABORT_LIMIT',15000);

class AbstractTest {
  var $parameters, $startTime;
  function init() {}
  function getTitle(){ return "A Test"; }
  function getDescription(){ return "Unknown test"; }
  function getRelease(){ return 1; } 
  function getDefaultOn(){ return false; }
  function isBenchmark(){ return false; }
  function getParametersForm(){ return ""; }
  function setParametersFromPost(){ 
    if($this->getParametersForm()!='')
      $this->setParameters($_POST);
    else 
      $this->setParameters('');
  }
  function setParameters($parameters){ $this->parameters = $parameters; }
  function getParameters(){ return $this->parameters; }
  function setUp(){ return true; }  
  function doTest(){ sleep(1); }
  function doBenchmark() {
    $this->startTime = microtime_float();
    $this->doTest();
    return microtime_float()-$this->startTime;  
  }
  function shouldAbort() {
    return microtime_float()-$this->startTime>ABORT_LIMIT;
  }
  function tearDown(){}
  function isValid(){ return $this->getTxtResults()==OK_STR; }
  function getTxtResults(){ return OK_STR; }
}

?>
Return current item: HostingBenchmark