Added some PHPUnit Tests

This commit is contained in:
kremsy
2017-04-16 14:43:13 +02:00
parent 879b3056ce
commit 5e0a5c48a2
8 changed files with 285 additions and 15 deletions

View File

@ -33,7 +33,7 @@ class CallbackHelpStructure extends DocumentationStructure {
* @api
* @return mixed
*/
public function getMethodName() {
public function getCallbackName() {
return $this->callbackName;
}

View File

@ -589,7 +589,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$this->getChat()->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!');
$this->startTime = time();
// Main loop
while (!$this->requestQuitMessage) {
$this->loop();
@ -613,8 +613,9 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/**
* Connect to ManiaPlanet server
* Public only for PHPUnit Tests
*/
private function connect() {
public function connect() {
// Load remote client
$serverConfig = $this->getServer()->loadConfig();

View File

@ -3,6 +3,7 @@
namespace ManiaControl\Script;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Callbacks\Structures\XmlRpc\CallbackListStructure;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl;
@ -38,6 +39,7 @@ class ModeScriptEventManager implements UsageInformationAble {
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('true'));
$this->setApiVersion(self::API_VERSION);
$this->unBlockAllCallbacks();
}
/**
@ -80,7 +82,18 @@ class ModeScriptEventManager implements UsageInformationAble {
}
/**
* Provide a Array of Callbacks you want to Block
* UnBlocks All Callbacks
*
* @api
*/
public function unBlockAllCallbacks() {
$this->getListOfDisabledCallbacks()->setCallable(function (CallbackListStructure $structure) {
$this->unBlockCallbacks($structure->getCallbacks());
});
}
/**
* Provide a Array of Callbacks you want to UnBlock
*
* @api
* @param array $callbackNames
@ -325,7 +338,7 @@ class ModeScriptEventManager implements UsageInformationAble {
* @param $y
* @param $z
*/
public function suegeSetProgressionUIPosition($x, $y, $z) {
public function siegeSetProgressionUIPosition($x, $y, $z) {
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Siege.SetProgressionUIPosition', array(strval(floatval($x)), strval(floatval($y)), strval(floatval($z))));
}