<?php // INCLUDED VIA github.api.inc.php // //include("lib/curl.inc.php"); $sTitle = "Test http base classes"; $sFileName = "lib/http.base.inc.php"; _printTestFileHeader($sTitle, $sFileName); // TEST CCurlBaseGet $sURL = "http://gudtril.cyb3r.ca/test/utils/test.get.html"; $oTCH = new CTestClassHelper("CHTTPBaseGet", array($sURL)); $oTCH->RegisterMethodNoReturn("PrepareOptions", array()); $oTCH->RegisterMethodWithReturn("Execute", array()); $oTCH->RunTestMap(); // TEST CCurlBasePost $sURL = "http://gudtril.cyb3r.ca/test/utils/test.post.php"; $sPost = "name=Cyb3r&project=GudTril&test=1"; $oTCH = new CTestClassHelper("CHTTPBasePost", array($sURL)); $oTCH->RegisterMethodNoReturn("PrepareOptions", array()); $oTCH->RegisterMethodNoReturn("SetPostString", array($sPost)); $oTCH->RegisterMethodWithReturn("Execute", array()); $oTCH->RunTestMap();
// INCLUDED VIA github.api.inc.php // //include("lib/github.connect.inc.php"); $sTitle = "Test Github connection classes"; $sFileName = "lib/github.connect.inc.php"; _printTestFileHeader($sTitle, $sFileName); // TEST CGithubConnect - GET _printHTMLSubSectionHeader("GET Test"); $sBaseURL = "http://gudtril.cyb3r.ca/test/utils"; $sResponseType = "/" . CGithubResponseTypes::sXML; $sAPIRequest = "/hello_world"; $oTCH = new CTestClassHelper("CGithubConnect", array($sBaseURL, CHTTPRequestMethods::iGet)); $oTCH->RegisterMethodNoReturn("SetResponseType", array($sResponseType)); $oTCH->RegisterMethodNoReturn("SetAPIRequest", array($sAPIRequest)); $oTCH->RegisterMethodWithReturn("GetURL", array()); $oTCH->RegisterMethodWithReturn("Request", array()); $oTCH->RunTestMap(); // TEST CGithubConnect - POST _printHTMLSubSectionHeader("POST Test"); $sBaseURL = "http://gudtril.cyb3r.ca"; $sResponseType = "/test/utils"; $sAPIRequest = "/test.post.php"; $sPostString = "name=Cyb3r&project=GudTril&test=1"; $oTCH = new CTestClassHelper("CGithubConnect", array($sBaseURL, CHTTPRequestMethods::iPost)); $oTCH->RegisterMethodNoReturn("SetResponseType", array($sResponseType)); $oTCH->RegisterMethodNoReturn("SetAPIRequest", array($sAPIRequest)); $oTCH->RegisterMethodNoReturn("SetPostString", array($sPostString)); $oTCH->RegisterMethodWithReturn("GetURL", array()); $oTCH->RegisterMethodWithReturn("Request", array()); $oTCH->RunTestMap();
{ parent::__construct(); } } //// //// CLASS - TEST CLASS FOR LIMITATOR //// // class CCTestLimitator { public function __construct() { // } public function RunTest() { $iNow = time(); $iStartTime = $iNow; $iElapsed = $iNow - $iStartTime; while ($iElapsed < 30) { $o = new CInheritanceTest(); echo $o->GetCounter() . "<br />"; echo $o->GetElapsedTime() . "<br />"; $iElapsed = $iNow - $iStartTime; } } } //// TEST $oTCH = new CTestClassHelper("CCTestLimitator", array()); $oTCH->RegisterMethodNoReturn("RunTest", array()); $oTCH->RunTestMap();
$sResponseType = CGithubResponseTypes::sXML; $sAPIRequest = "/issues/list/" . $sUser . "/" . $sRepo . "/" . $sState; $oTCH = new CTestClassHelper("CGithubAPIRequester", array($sAPIRequest, CHTTPRequestMethods::iGet, $sResponseType, true)); $oTCH->RegisterMethodNoReturn("AssembleRequest", array()); $oTCH->RegisterMethodWithReturn("GetURL", array()); $oTCH->RegisterMethodWithReturn("RequestService", array()); $oTCH->RunTestMap(); // TEST CGithubAPIRequester - POST $sTitle = "Testing API opening issue"; $sBody = rand(0, time()); _printHTMLSubSectionHeader("POST Test"); $sResponseType = CGithubResponseTypes::sJSON; $sAPIRequest = "/issues/open/" . $sUser . "/" . $sRepo; $sPostString = "title=" . $sTitle . "&body=" . $sBody; $oTCH = new CTestClassHelper("CGithubAPIRequester", array($sAPIRequest, CHTTPRequestMethods::iPost, $sResponseType, true)); $oTCH->RegisterMethodNoReturn("AssembleRequest", array($sPostString)); $oTCH->RegisterMethodWithReturn("GetURL", array()); $oTCH->RegisterMethodWithReturn("RequestService", array()); $oTCH->RunTestMap(); $sTitle = "Test Github Services API classes"; $sFileName = "lib/github.api.services.inc.php"; _printTestFileHeader($sTitle, $sFileName); // TEST CGithubAPIRequestServices - GET $sUser = "******"; $sRepo = "GudTril"; $bForceAuthenticate = true; _printHTMLSubSectionHeader("GET Test"); $sResponseType = CGithubResponseTypes::sXML; $sAPIRequest = "/issues/labels/" . $sUser . "/" . $sRepo; $oTCH = new CTestClassHelper("CGithubAPIRequestServices", array($sResponseType, $bForceAuthenticate)); $oTCH->RegisterMethodWithReturn("RequestService", array($sAPIRequest, CHTTPRequestMethods::iGet, false));