Commit 81d23f99 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Store, Constants, Save, StoreTest: undo renaming STORE_0 back to STORE_ZERO....

Store, Constants, Save, StoreTest: undo renaming STORE_0 back to STORE_ZERO. const with a number at the end seems not to be accepted in the phpunittests.
parent 141761eb
......@@ -126,7 +126,7 @@ const STORE_TABLE_DEFAULT = "D"; // definition of primary table.
const STORE_TABLE_COLUMN_TYPES = "M"; // column types of primary table.
const STORE_CLIENT = "C"; // Client: POST variable, if not found: GET variable
const STORE_TYPO3 = "T"; // Typo3 > Page content record > bodytext
const STORE_0 = "0"; // value: 0, might helpfull if variable is empty but used in an SQL statement, which might produce a SQL error otherwise if substituted with an empty string
const STORE_ZERO = "0"; // value: 0, might helpfull if variable is empty but used in an SQL statement, which might produce a SQL error otherwise if substituted with an empty string
const STORE_SYSTEM = "Y"; // various system values like db connection credentials
const USE_STORE_DEFAULT = "FSRD";
......
......@@ -59,7 +59,7 @@ class Save {
$this->elements($row['_id']);
}
} else {
$this->elements($this->store->getVar(SIP_RECORD_ID, STORE_SIP . STORE_0));
$this->elements($this->store->getVar(SIP_RECORD_ID, STORE_SIP . STORE_ZERO));
}
}
......
......@@ -138,7 +138,7 @@ class Store {
STORE_TABLE_COLUMN_TYPES => false,
STORE_CLIENT => true,
STORE_TYPO3 => false,
STORE_0 => false,
STORE_ZERO => false,
STORE_SYSTEM => false
];
......@@ -172,7 +172,7 @@ class Store {
throw new UserException("Unknown Store: $store", ERROR_UNNOWN_STORE);
if ($store === STORE_0)
if ($store === STORE_ZERO)
throw new CodeException("setVarArray() for STORE_ZERO is impossible - there are no values.", ERROR_SET_STORE_ZERO);
if ($flagOverwrite && isset(self::$raw[$store]) && count(self::$raw[$store]) > 0) {
......@@ -265,7 +265,7 @@ class Store {
$useStores = substr($useStores, 1); // shift left remaining stores
if (!isset(self::$raw[$store][$key])) {
if ($store === STORE_0) {
if ($store === STORE_ZERO) {
return 0;
} else {
continue; // no value provided
......@@ -318,7 +318,7 @@ class Store {
if (!isset(self::$sanatizeStore))
throw new UserException("Unknown Store: $store", ERROR_UNNOWN_STORE);
if ($store === STORE_0)
if ($store === STORE_ZERO)
throw new CodeException("unsetStore() for STORE_ZERO is impossible - there are no values.", ERROR_SET_STORE_ZERO);
if (isset(self::$raw[$store])) {
......@@ -371,7 +371,7 @@ class Store {
if (!isset(self::$sanatizeStore))
throw new UserException("Unknown Store: $store", ERROR_UNNOWN_STORE);
if ($store === STORE_0)
if ($store === STORE_ZERO)
throw new CodeException("setVar() for STORE_ZERO is impossible - there are no values.", ERROR_SET_STORE_ZERO);
if ($overWrite === false && isset(self::$raw[$store][$key])) {
......@@ -390,7 +390,7 @@ class Store {
if (!isset(self::$sanatizeStore))
throw new UserException("Unknown Store: $store", ERROR_UNNOWN_STORE);
if ($store === STORE_0)
if ($store === STORE_ZERO)
throw new CodeException("getStore() for STORE_ZERO is impossible - there are no values saved.", ERROR_GET_STORE_ZERO);
if (isset(self::$raw[$store])) {
......
......@@ -150,10 +150,10 @@ class StoreTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('green', $this->store->getVar('color', '', SANATIZE_ALLOW_ALNUMX), "Retrieve 'color' from STORE_FORM");
}
public function testGetVarStoreZero() {
public function testGetVarStore0() {
//default prio FSRD
$this->assertEquals(0, $this->store->getVar('fakename', '', STORE_0), "Retrieve anything from STORE_ZERO");
$this->assertEquals(0, $this->store->getVar('fakename', STORE_ZERO), "Retrieve anything from STORE_ZERO");
}
public function testUnsetStore() {
......
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