//$oTCH->RegisterMethodWithReturn("CloseIssue", array($sUser, $sRepo, $iNumber));
//$iNumber = 4;
//$oTCH->RegisterMethodWithReturn("ReOpenIssue", array($sUser, $sRepo, $iNumber));
//$oTCH->RegisterMethodWithReturn("ListLabels", array($sUser, $sRepo));
//$sLabel = "Label2";
//$iNumber = "2";
//$oTCH->RegisterMethodWithReturn("AddLabel", array($sUser, $sRepo, $sLabel, $iNumber));
//$sLabel = "Label1";
//$iNumber = "1";
//$oTCH->RegisterMethodWithReturn("RemoveLabel", array($sUser, $sRepo, $sLabel, $iNumber));
$oTCH->RunTestMap();
echo "Number of API requests: " . CGithubAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CGithubAPICallLimitator::$_iElapsedTime . "<br />";
// TEST CGithubAPIRequester - POST
_printHTMLSubSectionHeader("GET Test");
$oTCH = new CTestClassHelper("CGithubIssues", array($sResponseType, $bAuthenticate));
//$sState = CGithubIssueStates::sClosed;
//$sSearchTerm = "opening";
//$oTCH->RegisterMethodWithReturn("SearchIssues", array($sUser, $sRepo, $sState, $sSearchTerm));
$sState = CGithubIssueStates::sOpen;
$oTCH->RegisterMethodWithReturn("ListIssues", array($sUser, $sRepo, $sState));
//$iNumber = 2;
//$oTCH->RegisterMethodWithReturn("ViewIssue", array($sUser, $sRepo, $iNumber));
//$iNumber = 5;
//$oTCH->RegisterMethodWithReturn("ListCommentsByIssue", array($sUser, $sRepo, $iNumber));
$sTitle = "Test open issue 100 Title";
$sBody = "Test open issue 100";
$oTCH->RegisterMethodWithReturn("OpenIssue", array($sUser, $sRepo, $sTitle, $sBody));
//$iNumber = 10;
//$oTCH->RegisterMethodWithReturn("CloseIssue", array($sUser, $sRepo, $iNumber));
//$iNumber = 6;
//$oTCH->RegisterMethodWithReturn("SearchUsers", array($sSearch));
//$sUser = "******";
//$oTCH->RegisterMethodWithReturn("GetUserInfo", array($sUser));
//$oTCH->RegisterMethodWithReturn("GetURL", array());
//$sUser = "******";
//$oTCH->RegisterMethodWithReturn("ShowWhoUserFollowing", array($sUser));
//$sUser = "******";
//$oTCH->RegisterMethodWithReturn("ShowWhoUserFollowers", array($sUser));
//$sUser = "******";
//$oTCH->RegisterMethodWithReturn("ShowWatchedRepos", array($sUser));
//$oTCH->RunTestMap();
echo "Number of API requests: " . CGithubAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CGithubAPICallLimitator::$_iElapsedTime . "<br />";
// TEST CGithubUsers - POST
_printHTMLSubSectionHeader("POST Test");
$oTCH = new CTestClassHelper("CGithubUser", array($sResponseType, $bAuthenticate));
//$sSearch = "pete";
//$oTCH->RegisterMethodWithReturn("SearchUsers", array($sSearch));
//$sUser = "******";
//$oTCH->RegisterMethodWithReturn("GetUserInfo", array($sUser));
$sUser = "******";
//$sName = "Serafim Junior Dos Santos - Test";
$sName = "";
$sEmail = "";
$sBlog = "http://www.cyb3r.ca/test";
//$sCompany = "Serafim Junior Dos Santos Fagundes Cyb3r Web - Test";
$sCompany = "";
//$sLocation = "Montréal, Québec, Canada";
$sLocation = "";
$oTCH->RegisterMethodWithReturn("SetUserInfo", array($sUser, $sName, $sEmail, $sBlog, $sCompany, $sLocation));
$oTCH->RegisterMethodWithReturn("IsAuthenticated", array());
示例#3
0
<?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();
$sResponseType = CGithubResponseTypes::sXML;
$bAuthenticate = false;
$sUser = "******";
$sRepoName = "GudTril";
// TEST CGithubCommit - GET
_printHTMLSubSectionHeader("GET Test");
$oTCH = new CTestClassHelper("CGithubCommit", array($sResponseType, $bAuthenticate));
$sBranch = "0.3.1";
$oTCH->RegisterMethodWithReturn("ListOnBranch", array($sUser, $sRepoName, $sBranch));
$oTCH->RegisterMethodWithReturn("GetURL", array());
$sBranch = "0.3.1";
$sFilePath = "lib/curl.inc.php";
$oTCH->RegisterMethodWithReturn("ListOnFile", array($sUser, $sRepoName, $sBranch, $sFilePath));
$sSHA = "f2ace7d6083881331e93732a1ace801e5e870225";
$oTCH->RegisterMethodWithReturn("ShowSpecific", array($sUser, $sRepoName, $sSHA));
$oTCH->RunTestMap();
echo "Number of API requests: " . CGithubAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CGithubAPICallLimitator::$_iElapsedTime . "<br />";
// TEST CGithubCommit - POST
_printHTMLSubSectionHeader("POST Test");
$oTCH = new CTestClassHelper("CGithubCommit", array($sResponseType, $bAuthenticate));
$sBranch = "0.4.1";
$oTCH->RegisterMethodWithReturn("ListOnBranch", array($sUser, $sRepoName, $sBranch));
$sBranch = "0.4.1";
$sFilePath = "lib/github.api.repositories.inc.php";
$oTCH->RegisterMethodWithReturn("ListOnFile", array($sUser, $sRepoName, $sBranch, $sFilePath));
$sSHA = "e5f495e7b5c028743b98a1e6f042a29d1fed901f";
$oTCH->RegisterMethodWithReturn("ShowSpecific", array($sUser, $sRepoName, $sSHA));
$oTCH->RunTestMap();
echo "Number of API requests: " . CGithubAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CGithubAPICallLimitator::$_iElapsedTime . "<br />";
//$sUser
$oTCH->RegisterMethodWithReturn("ShowUserRepos", array($sUser));
//$sUser, $sRepo
$oTCH->RegisterMethodWithReturn("ListRepoNetwork", array($sUser, $sRepo));
//$sUser, $sRepo
$oTCH->RegisterMethodWithReturn("ShowRepoLanguages", array($sUser, $sRepo));
//$sUser, $sRepo
$oTCH->RegisterMethodWithReturn("ShowRepoTags", array($sUser, $sRepo));
//$sUser, $sRepo
$oTCH->RegisterMethodWithReturn("ShowRepoBranches", array($sUser, $sRepo));
$oTCH->RunTestMap();
echo "Number of API requests: " . CGithubAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CGithubAPICallLimitator::$_iElapsedTime . "<br />";
// TEST CGithubRepository - POST
_printHTMLSubSectionHeader("POST Test");
$oTCH = new CTestClassHelper("CGithubRepository", array($sResponseType, $bAuthenticate));
$sSearchTerm = "jQuery";
$oTCH->RegisterMethodWithReturn("SearchRepos", array($sSearchTerm));
//$sUser, $sRepo
$oTCH->RegisterMethodWithReturn("ShowRepoInfo", array($sUser, $sRepo));
//$sUser
$oTCH->RegisterMethodWithReturn("ShowUserRepos", array($sUser));
//$sUser = "******";
//$sRepo = "WebFW";
//$oTCH->RegisterMethodWithReturn("WatchRepo", array($sUser, $sRepo));
//$sUser, $sRepo
//$oTCH->RegisterMethodWithReturn("UnWatchRepo", array($sUser, $sRepo));
//$sUser = "******";
//$sRepo = "git-close";
//$oTCH->RegisterMethodWithReturn("ForkRepo", array($sUser, $sRepo));
//$sRepoName = "Test-REPO-API";
<?php

// INCLUDED VIA bc.apiw.inc.php
//
//include("lib/bc.api.to-do-lists.inc.php");
$sTitle = "Test Basecamp To-Do Lists API classes";
$sFileName = "lib/bc.api.to-do-lists.inc.php";
_printTestFileHeader($sTitle, $sFileName);
$sAccountName = "";
$sToken = "";
$bHTTPS = true;
$oTCH = new CTestClassHelper("CBasecampToDoLists", array($sAccountName, $sToken, $bHTTPS));
//$ciPartyType
//$iResponsiblePartyId
$oTCH->RegisterMethodWithReturn("ShowAllFromAllProjects", array());
//$iProjectId = ;
//$csFilter = CBasecampToDoLists::sFilterAll;
//$oTCH->RegisterMethodWithReturn("ShowAllFromProject", array($iProjectId, $csFilter));
//$iListId = ;
//$oTCH->RegisterMethodWithReturn("Show", array($iListId));
$oTCH->RunTestMap();
echo "Number of API requests: " . CBasecampAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CBasecampAPICallLimitator::$_iElapsedTime . "<br />";
<?php

// INCLUDED VIA bp.api.inc.php
//
//include("lib/bp.api.pages.inc.php");
$sTitle = "Test Backpack List Items API classes";
$sFileName = "lib/bp.api.list-items.inc.php";
_printTestFileHeader($sTitle, $sFileName);
$sAccountName = "";
$sToken = "";
$bHTTPS = true;
$oTCH = new CTestClassHelper("CBackpackAPIPages", array($sAccountName, $sToken, $bHTTPS));
$iPageId = "";
$iListId = "";
$oTCH->RegisterMethodWithReturn("List", array($iPageId, $iListId));
$oTCH->RunTestMap();
echo "Number of API requests: " . CBackpackAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CBackpackAPICallLimitator::$_iElapsedTime . "<br />";
    {
        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();
<?php

// INCLUDED VIA bc.apiw.inc.php
//
//include("lib/bc.api.to-do-list-items.inc.php");
$sTitle = "Test Basecamp To-Do List Items API classes";
$sFileName = "lib/bc.api.to-do-list-items.inc.php";
_printTestFileHeader($sTitle, $sFileName);
$sAccountName = "";
$sToken = "";
$bHTTPS = true;
$oTCH = new CTestClassHelper("CBasecampToDoListItems", array($sAccountName, $sToken, $bHTTPS));
//$iListId = ;
//$oTCH->RegisterMethodWithReturn("ShowAllFromList", array($iListId));
//$iItemId = ;
//$oTCH->RegisterMethodWithReturn("Show", array($iItemId));
//$iItemId = ;
//$oTCH->RegisterMethodNoReturn("CompleteItem", array($iItemId));
//$iItemId = ;
//$oTCH->RegisterMethodNoReturn("UncompleteItem", array($iItemId));
//$iListId = ;
//$oXMLRequest = new CBcXOReorderToDoItems();
//$oXMLRequest->SetOrder("1, 2, 3");
//$oTCH->RegisterMethodNoReturn("Reorder", array($iListId, $oXMLRequest));
$oTCH->RunTestMap();
echo "Number of API requests: " . CBasecampAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CBasecampAPICallLimitator::$_iElapsedTime . "<br />";
// TEST CGithubObject - GET
_printHTMLSubSectionHeader("GET Test");
$oTCH = new CTestClassHelper("CGithubObject", array($sResponseType, $bAuthenticate));
$sTreeSHA = "7713cdad2d88f434d1302145193127905a92be42";
$oTCH->RegisterMethodWithReturn("ShowTree", array($sUser, $sRepoName, $sTreeSHA));
//$oTCH->RegisterMethodWithReturn("GetURL", array());
$sTreeSHA = "f691d1833468afa33af8078a421d09b275eb339b";
$sPath = "lib/http.requester.inc.php";
$oTCH->RegisterMethodWithReturn("BlobByTreeSHA", array($sUser, $sRepoName, $sTreeSHA, $sPath));
$sTreeSHA = "2734e62d8efb7abe79fc6e4be05740b747f6d327";
$oTCH->RegisterMethodWithReturn("ListBlobs", array($sUser, $sRepoName, $sTreeSHA));
$sSHA = "f691d1833468afa33af8078a421d09b275eb339b";
$oTCH->RegisterMethodWithReturn("ShowBlob", array($sUser, $sRepoName, $sSHA));
$oTCH->RunTestMap();
echo "Number of API requests: " . CGithubAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CGithubAPICallLimitator::$_iElapsedTime . "<br />";
// TEST CGithubObject - POST
_printHTMLSubSectionHeader("POST Test");
$oTCH = new CTestClassHelper("CGithubObject", array($sResponseType, $bAuthenticate));
$sTreeSHA = "7713cdad2d88f434d1302145193127905a92be42";
$oTCH->RegisterMethodWithReturn("ShowTree", array($sUser, $sRepoName, $sTreeSHA));
$sTreeSHA = "577d65ad91840cb5fdf70f5b8f20d8e67fc13ea6";
$sPath = "lib/github.connect.inc.php";
$oTCH->RegisterMethodWithReturn("BlobByTreeSHA", array($sUser, $sRepoName, $sTreeSHA, $sPath));
$sTreeSHA = "d76f045fe37c481c9add0aa16df9bc9cee2d812a";
$oTCH->RegisterMethodWithReturn("ListBlobs", array($sUser, $sRepoName, $sTreeSHA));
$sSHA = "2734e62d8efb7abe79fc6e4be05740b747f6d327";
$oTCH->RegisterMethodWithReturn("ShowBlob", array($sUser, $sRepoName, $sSHA));
$oTCH->RunTestMap();
echo "Number of API requests: " . CGithubAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CGithubAPICallLimitator::$_iElapsedTime . "<br />";
// 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();
$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));
$oTCH->RunTestMap();
// TEST CGithubAPIRequestServices - POST
$sComment = rand(0, time());
$iNumber = 6;
$bForceAuthenticate = true;
_printHTMLSubSectionHeader("POST Test");
$sResponseType = CGithubResponseTypes::sYAML;
$sAPIRequest = "/issues/comment/" . $sUser . "/" . $sRepo . "/" . $iNumber;
$sPostString = "comment=" . $sComment;
$oTCH = new CTestClassHelper("CGithubAPIRequestServices", array($sResponseType, $bForceAuthenticate));
$oTCH->RegisterMethodWithReturn("RequestService", array($sAPIRequest, CHTTPRequestMethods::iPost, false, $sPostString));
$oTCH->RunTestMap();
示例#13
0
<?php

// INCLUDED VIA bp.api.inc.php
//
//include("lib/bp.api.pages.inc.php");
$sTitle = "Test Backpack Pages API classes";
$sFileName = "lib/bp.api.pages.inc.php";
_printTestFileHeader($sTitle, $sFileName);
$sAccountName = "";
$sToken = "";
$bHTTPS = true;
$oTCH = new CTestClassHelper("CBackpackAPIPages", array($sAccountName, $sToken, $bHTTPS));
$oTCH->RegisterMethodWithReturn("ListAll", array());
$oTCH->RunTestMap();
echo "Number of API requests: " . CBackpackAPICallLimitator::$_iCounter . "<br />";
echo "Elapsed time since first request: " . CBackpackAPICallLimitator::$_iElapsedTime . "<br />";
<?php

// INCLUDED VIA github.api.inc.php
//
//include("lib/http.requester.inc.php");
$sTitle = "Test HTTP requester classe";
$sFileName = "lib/http.requester.inc.php";
_printTestFileHeader($sTitle, $sFileName);
// TEST CHTTPRequest - GET
_printHTMLSectionHeader("GET Test");
$sURL = "http://gudtril.cyb3r.ca/test/utils/test.get.html";
$oTCH = new CTestClassHelper("CHTTPRequester", array($sURL, CHTTPRequestMethods::iGet));
$oTCH->RegisterMethodWithReturn("Request", array());
$oTCH->RunTestMap();
// TEST CHTTPRequest - POST
_printHTMLSectionHeader("POST Test");
$sURL = "http://gudtril.cyb3r.ca/test/utils/test.post.php";
$sPostString = "name=Cyb3r&project=GudTril&test=1";
$oTCH = new CTestClassHelper("CHTTPRequester", array($sURL, CHTTPRequestMethods::iPost, $sPostString));
$oTCH->RegisterMethodWithReturn("Request", array());
$oTCH->RunTestMap();