Commit 06ad3237 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Fix unit tests

parent de576531
Pipeline #2897 failed with stages
in 2 minutes and 41 seconds
...@@ -702,7 +702,6 @@ const SIP_URLPARAM = 'urlparam'; ...@@ -702,7 +702,6 @@ const SIP_URLPARAM = 'urlparam';
const SIP_SIP_URL = 'sipUrl'; const SIP_SIP_URL = 'sipUrl';
const SIP_MAKE_URLPARAM_UNIQ = '_makeUrlParamUniq'; // SIPs for 'new records' needs to be uniq per TAB! Therefore add a uniq parameter const SIP_MAKE_URLPARAM_UNIQ = '_makeUrlParamUniq'; // SIPs for 'new records' needs to be uniq per TAB! Therefore add a uniq parameter
const SIP_DOWNLOAD_PARAMETER = '_b64_download'; // Parameter name, filled in SIP, to hold all download element parameter. const SIP_DOWNLOAD_PARAMETER = '_b64_download'; // Parameter name, filled in SIP, to hold all download element parameter.
const TAB_UNIQ_ID = 'tabUniqId'; // Currently only only a uniq identifier: no values stored behind the identifier - might change.
const SIP_PREFIX_BASE64 = '_b64'; const SIP_PREFIX_BASE64 = '_b64';
...@@ -1815,6 +1814,7 @@ const DIRTY_API_ACTION_EXTEND = 'extend'; ...@@ -1815,6 +1814,7 @@ const DIRTY_API_ACTION_EXTEND = 'extend';
const LOCK_NOT_FOUND = 0; const LOCK_NOT_FOUND = 0;
const LOCK_FOUND_OWNER = 1; const LOCK_FOUND_OWNER = 1;
const LOCK_FOUND_CONFLICT = 2; const LOCK_FOUND_CONFLICT = 2;
const TAB_UNIQ_ID = 'tabUniqId'; // Currently only only a uniq identifier: no values stored behind the identifier - might change.
// AutoCron // AutoCron
const AUTOCRON_MAX_AGE_MINUTES = 10; const AUTOCRON_MAX_AGE_MINUTES = 10;
......
...@@ -83,7 +83,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -83,7 +83,7 @@ class DirtyTest extends AbstractDatabaseTest {
protected $sip = null; protected $sip = null;
/** /**
* @var Database instantiated class * @var Database[] - Array of Database instantiated class
*/ */
protected $dbArray = null; protected $dbArray = null;
...@@ -339,12 +339,15 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -339,12 +339,15 @@ class DirtyTest extends AbstractDatabaseTest {
// Alice lock - but change cookie later to Bob // Alice lock - but change cookie later to Bob
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '1';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
// move lock to another owner (Alice fake becomes Bob) // move lock to another owner (Alice fake becomes Bob)
$this->dbArray[DB_INDEX_DEFAULT]->sql("UPDATE Dirty SET qfqUserSessionCookie='SessionCookieBob' WHERE id=1", ROW_REGULAR); $this->dbArray[DB_INDEX_DEFAULT]->sql("UPDATE Dirty SET qfqUserSessionCookie='SessionCookieBob' WHERE id=1", ROW_REGULAR);
$_GET[TAB_UNIQ_ID] = '2';
$dirty = new Dirty();
// Alice lock again // Alice lock again
$result = $dirty->process(); $result = $dirty->process();
...@@ -486,6 +489,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -486,6 +489,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Alice lock 1 Form A // Alice lock 1 Form A
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory", RETURN_SIP);
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '1';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -499,6 +503,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -499,6 +503,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Bob lock 1 Form B // Bob lock 1 Form B
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory2", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory2", RETURN_SIP);
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '2';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -682,12 +687,15 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -682,12 +687,15 @@ class DirtyTest extends AbstractDatabaseTest {
// Alice lock - but change cookie later to Bob // Alice lock - but change cookie later to Bob
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '1';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
// move lock to another owner (Alice fake becomes Bob) // move lock to another owner (Alice fake becomes Bob)
$this->dbArray[DB_INDEX_DEFAULT]->sql("UPDATE Dirty SET qfqUserSessionCookie='SessionCookieBob' WHERE id=1", ROW_REGULAR); $this->dbArray[DB_INDEX_DEFAULT]->sql("UPDATE Dirty SET qfqUserSessionCookie='SessionCookieBob' WHERE id=1", ROW_REGULAR);
$_GET[TAB_UNIQ_ID] = '2';
$dirty = new Dirty();
// Alice lock again // Alice lock again
$result = $dirty->process(); $result = $dirty->process();
...@@ -828,6 +836,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -828,6 +836,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Alice lock 1 Form A // Alice lock 1 Form A
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive", RETURN_SIP);
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '1';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -841,6 +850,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -841,6 +850,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Bob lock 1 Form B // Bob lock 1 Form B
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive2", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive2", RETURN_SIP);
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '2';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -949,6 +959,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -949,6 +959,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Alice lock 1 Form A // Alice lock 1 Form A
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory", RETURN_SIP);
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '1';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -961,6 +972,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -961,6 +972,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Bob lock 1 Form B // Bob lock 1 Form B
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockNone", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockNone", RETURN_SIP);
$_GET[TAB_UNIQ_ID] = '2';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -991,6 +1003,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -991,6 +1003,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Alice lock 1 Form A // Alice lock 1 Form A
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory", RETURN_SIP);
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '1';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -1003,6 +1016,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -1003,6 +1016,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Bob lock 1 Form B // Bob lock 1 Form B
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive", RETURN_SIP);
$_GET[TAB_UNIQ_ID] = '2';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -1033,6 +1047,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -1033,6 +1047,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Alice lock 1 Form A // Alice lock 1 Form A
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive", RETURN_SIP);
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '1';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -1045,6 +1060,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -1045,6 +1060,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Bob lock 1 Form B // Bob lock 1 Form B
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockNone", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockNone", RETURN_SIP);
$_GET[TAB_UNIQ_ID] = '2';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -1075,6 +1091,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -1075,6 +1091,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Alice lock 1 Form A // Alice lock 1 Form A
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockExclusive", RETURN_SIP);
$_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK; $_GET[DIRTY_API_ACTION] = DIRTY_API_ACTION_LOCK;
$_GET[TAB_UNIQ_ID] = '1';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
...@@ -1087,6 +1104,7 @@ class DirtyTest extends AbstractDatabaseTest { ...@@ -1087,6 +1104,7 @@ class DirtyTest extends AbstractDatabaseTest {
// Bob lock 1 Form B // Bob lock 1 Form B
$_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory", RETURN_SIP); $_GET[CLIENT_SIP] = $this->sip->queryStringToSip("?id=input&r=1&form=lockAdvisory", RETURN_SIP);
$_GET[TAB_UNIQ_ID] = '2';
$dirty = new Dirty(); $dirty = new Dirty();
$result = $dirty->process(); $result = $dirty->process();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment