Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Nov 21, 2023
2 parents 169875c + b647c39 commit 054aff9
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 3 deletions.
16 changes: 13 additions & 3 deletions assets/packages/expressions/em_javascript.js
Expand Up @@ -68,7 +68,9 @@ function checkconditions(value, name, type, evt_type)
}*/
try{
ExprMgr_process_relevance_and_tailoring(evt_type,name,type);
} catch(e) { console.ls.error(e); }
} catch(e) {
console.ls.error(e);
}
}

/**
Expand Down Expand Up @@ -234,8 +236,16 @@ $(document).on("change",".radio-item :radio:not([onclick]), .button-item :radio:
$(document).on("change",".checkbox-item :checkbox:not([onclick]),.button-item :checkbox:not([onclick]), .ls-button-checkbox",function(event){
checkconditions($(this).val(), $(this).attr('name'), 'checkbox', 'click')
});
/* hidden item */
$(document).on("updated",".answer-item :hidden, .upload-item :hidden",function(event){
/* upload item */
$(document).on("updated",".upload-item :hidden",function(event){
checkconditions($(this).val(), $(this).attr('name'), 'upload', 'updated')
});
/* equation item */
$(document).on("updated",".hidden-item :hidden",function(event){
/* equation item must have a name */
if(!$(this).attr('name')) {
return;
}
checkconditions($(this).val(), $(this).attr('name'), 'equation', 'updated')
});
/* new multiple choice bootstrap buttons */
Expand Down
71 changes: 71 additions & 0 deletions tests/functional/backend/RemoteControlTest.php
@@ -0,0 +1,71 @@
<?php

namespace ls\tests;

use Yii;

class RemoteControlTest extends TestBaseClassWeb
{
private static $tmpBaseUrl;
private static $tmpRPCType;

private static $client;

public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();

$urlMan = Yii::app()->urlManager;
self::$tmpBaseUrl = $urlMan->getBaseUrl();
$urlMan->setBaseUrl('http://' . self::$domain . '/index.php');
//$serverUrl = App()->createAbsoluteUrl('/admin/remotecontrol');
$serverUrl = $urlMan->createUrl('/admin/remotecontrol');

self::$tmpRPCType = Yii::app()->getConfig('RPCInterface');

if (self::$tmpRPCType === 'off') {
\SettingGlobal::setSetting('RPCInterface', 'json');
$RPCType = 'json';
} else {
$RPCType = self::$tmpRPCType;
}

if ($RPCType == 'xml') {
$cur_path = get_include_path();
set_include_path($cur_path . PATH_SEPARATOR . APPPATH . 'helpers');
require_once('Zend/XmlRpc/Client.php');

self::$client = new \Zend_XmlRpc_Client($serverUrl);
} elseif ($RPCType == 'json') {
Yii::app()->loadLibrary('jsonRPCClient');
self::$client = new \jsonRPCClient($serverUrl);
}
}

public static function tearDownAfterClass(): void
{
parent::tearDownAfterClass();

$urlMan = Yii::app()->urlManager;
$urlMan->setBaseUrl(self::$tmpBaseUrl);

\SettingGlobal::setSetting('RPCInterface', self::$tmpRPCType);
}

public function testGetSessionKey()
{
$sessionKey = self::$client->call('get_session_key', ['admin', 'password']);
$this->assertIsString($sessionKey);

self::$client->call('release_session_key', [$sessionKey]);
}

public function testCredentialsError()
{
$sessionKey = self::$client->call('get_session_key', ['user', 'pass']);
$this->assertIsArray($sessionKey);
$this->assertSame("Invalid user name or password", $sessionKey['status']);

self::$client->call('release_session_key', [$sessionKey]);
}
}

0 comments on commit 054aff9

Please sign in to comment.