Commit b528ceb2 authored by Cédric Houbart's avatar Cédric Houbart
Browse files

Make tests pass

parent 0d81ea3b
......@@ -151,7 +151,7 @@ abstract class AbstractService {
return $row[0];
}
}
return false;
return null;
}
public function getAll() {
......@@ -164,7 +164,7 @@ abstract class AbstractService {
}
return $ret;
} else {
return false;
return null;
}
}
......@@ -178,7 +178,7 @@ abstract class AbstractService {
return static::build($row, $pdo);
}
} else {
return false;
return null;
}
}
......@@ -222,7 +222,7 @@ abstract class AbstractService {
}
return $ret;
} else {
return false;
return null;
}
}
......@@ -237,6 +237,4 @@ abstract class AbstractService {
return false;
}
}
}
?>
}
\ No newline at end of file
......@@ -482,10 +482,3 @@ INSERT INTO `RESOURCES` (`ID`, `NAME`, `RESTYPE`, `CONTENT`) VALUES
('11', 'Ticket.Buttons', 0, 0x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e0a3c212d2d200a202020204f70656e627261766f20504f53206973206120706f696e74206f662073616c6573206170706c69636174696f6e2064657369676e656420666f7220746f7563682073637265656e732e0a20202020436f707972696768742028432920323030382d32303039204f70656e627261766f2c20532e4c2e0a20202020687474703a2f2f736f75726365666f7267652e6e65742f70726f6a656374732f6f70656e627261766f706f730a0a20202020546869732066696c652069732070617274206f66204f70656e627261766f20504f532e0a0a202020204f70656e627261766f20504f53206973206672656520736f6674776172653a20796f752063616e2072656469737472696275746520697420616e642f6f72206d6f646966790a20202020697420756e64657220746865207465726d73206f662074686520474e552047656e6572616c205075626c6963204c6963656e7365206173207075626c69736865642062790a20202020746865204672656520536f66747761726520466f756e646174696f6e2c206569746865722076657273696f6e2033206f6620746865204c6963656e73652c206f720a2020202028617420796f7572206f7074696f6e2920616e79206c617465722076657273696f6e2e0a0a202020204f70656e627261766f20504f5320697320646973747269627574656420696e2074686520686f706520746861742069742077696c6c2062652075736566756c2c0a2020202062757420574954484f555420414e592057415252414e54593b20776974686f7574206576656e2074686520696d706c6965642077617272616e7479206f660a202020204d45524348414e544142494c495459206f72204649544e45535320464f52204120504152544943554c415220505552504f53452e2020536565207468650a20202020474e552047656e6572616c205075626c6963204c6963656e736520666f72206d6f72652064657461696c732e0a0a20202020596f752073686f756c642068617665207265636569766564206120636f7079206f662074686520474e552047656e6572616c205075626c6963204c6963656e73650a20202020616c6f6e672077697468204f70656e627261766f20504f532e20204966206e6f742c20736565203c687474703a2f2f7777772e676e752e6f72672f6c6963656e7365732f3e2e0a202d2d3e0a3c636f6e66696775726174696f6e3e0a202020203c627574746f6e206b65793d22627574746f6e2e7072696e7422207469746c656b65793d22627574746f6e2e7072696e74222074656d706c6174653d225072696e7465722e5469636b657450726576696577222f3e0a202020203c627574746f6e206b65793d22627574746f6e2e6f70656e64726177657222207469746c656b65793d22627574746f6e2e6f70656e647261776572222074656d706c6174653d225072696e7465722e4f70656e447261776572222f3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e6368616e67652220636f64653d226576656e742e6368616e6765222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e6164646c696e652220636f64653d226576656e742e6164646c696e65222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e72656d6f76656c696e652220636f64653d226576656e742e72656d6f76656c696e65222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e7365746c696e652220636f64653d226576656e742e7365746c696e65222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e73686f772220636f64653d226576656e742e73686f77222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e746f74616c2220636f64653d226576656e742e746f74616c222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e636c6f73652220636f64653d226576656e742e636c6f7365222f3e202d2d3e2020200a202020203c696d672d77696474682076616c75653d22313238222f3e0a202020203c696d672d6865696768742076616c75653d223634222f3e0a202020203c6361742d6865696768742076616c75653d2233303022202f3e0a202020203c7461786573696e636c756465642076616c75653d2266616c7365222f3e2020200a202020203c212d2d203c7072696e7473656c65637465642076616c75653d2274727565222f3e202d2d3e202020200a202020203c212d2d203c74617863617465676f727969642076616c75653d22303031222f3e202d2d3e0a202020203c212d2d203c707269636576697369626c652076616c75653d227472756522202f3e202d2d3e0a3c2f636f6e66696775726174696f6e3e0a),
('12', 'Ticket.Line', 0, 0x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e0a3c212d2d200a202020204f70656e627261766f20504f53206973206120706f696e74206f662073616c6573206170706c69636174696f6e2064657369676e656420666f7220746f7563682073637265656e732e0a20202020436f707972696768742028432920323030372d32303039204f70656e627261766f2c20532e4c2e0a20202020687474703a2f2f736f75726365666f7267652e6e65742f70726f6a656374732f6f70656e627261766f706f730a0a20202020546869732066696c652069732070617274206f66204f70656e627261766f20504f532e0a0a202020204f70656e627261766f20504f53206973206672656520736f6674776172653a20796f752063616e2072656469737472696275746520697420616e642f6f72206d6f646966790a20202020697420756e64657220746865207465726d73206f662074686520474e552047656e6572616c205075626c6963204c6963656e7365206173207075626c69736865642062790a20202020746865204672656520536f66747761726520466f756e646174696f6e2c206569746865722076657273696f6e2033206f6620746865204c6963656e73652c206f720a2020202028617420796f7572206f7074696f6e2920616e79206c617465722076657273696f6e2e0a0a202020204f70656e627261766f20504f5320697320646973747269627574656420696e2074686520686f706520746861742069742077696c6c2062652075736566756c2c0a2020202062757420574954484f555420414e592057415252414e54593b20776974686f7574206576656e2074686520696d706c6965642077617272616e7479206f660a202020204d45524348414e544142494c495459206f72204649544e45535320464f52204120504152544943554c415220505552504f53452e2020536565207468650a20202020474e552047656e6572616c205075626c6963204c6963656e736520666f72206d6f72652064657461696c732e0a0a20202020596f752073686f756c642068617665207265636569766564206120636f7079206f662074686520474e552047656e6572616c205075626c6963204c6963656e73650a20202020616c6f6e672077697468204f70656e627261766f20504f532e20204966206e6f742c20736565203c687474703a2f2f7777772e676e752e6f72672f6c6963656e7365732f3e2e0a202d2d3e0a0a3c6c696e653e0a202020203c636f6c756d6e206e616d653d226c6162656c2e6974656d222077696474683d223132352220616c69676e3d226c656674222076616c75653d22266c743b68746d6c2667743b2369662028247469636b65746c696e652e697350726f64756374436f6d28292920266c743b692667743b2a26616d703b6e6273703b26616d703b6e6273703b247b7469636b65746c696e652e7072696e744e616d6528297d266c743b2f692667743b2023656c736520247b7469636b65746c696e652e7072696e744e616d6528297d2023656e64266c743b62722667743b247b7469636b65746c696e652e67657450726f64756374417474536574496e73744465736328297d222f3e0a202020203c636f6c756d6e206e616d653d226c6162656c2e7072696365222077696474683d2238302220616c69676e3d227269676874222076616c75653d22247b7469636b65746c696e652e7072696e74507269636554617828297d222f3e0a202020203c636f6c756d6e206e616d653d226c6162656c2e756e697473222077696474683d2235302220616c69676e3d227269676874222076616c75653d2278247b7469636b65746c696e652e7072696e744d756c7469706c7928297d222f3e0a202020203c636f6c756d6e206e616d653d226c6162656c2e76616c7565222077696474683d2238302220616c69676e3d227269676874222076616c75653d22247b7469636b65746c696e652e7072696e7456616c756528297d222f3e0a3c2f6c696e653e),
('14', 'Menu.Root', 0, 0x2f2f20202020504f532d546563680a2f2f2020202042617365642075706f6e204f70656e627261766f20504f530a2f2f0a2f2f20202020436f707972696768742028432920323030372d32303039204f70656e627261766f2c20532e4c2e0a2f2f202020202020202020202020202020202020202020202032303132205341524c2053434f4f50205363696c2028687474703a2f2f7363696c2e636f6f70290a2f2f0a2f2f20202020546869732066696c652069732070617274206f6620504f532d546563682e0a2f2f0a2f2f20202020504f532d54656368206973206672656520736f6674776172653a20796f752063616e2072656469737472696275746520697420616e642f6f72206d6f646966790a2f2f20202020697420756e64657220746865207465726d73206f662074686520474e552047656e6572616c205075626c6963204c6963656e7365206173207075626c69736865642062790a2f2f20202020746865204672656520536f66747761726520466f756e646174696f6e2c206569746865722076657273696f6e2033206f6620746865204c6963656e73652c206f720a2f2f2020202028617420796f7572206f7074696f6e2920616e79206c617465722076657273696f6e2e0a2f2f0a2f2f20202020504f532d5465636820697320646973747269627574656420696e2074686520686f706520746861742069742077696c6c2062652075736566756c2c0a2f2f2020202062757420574954484f555420414e592057415252414e54593b20776974686f7574206576656e2074686520696d706c6965642077617272616e7479206f660a2f2f202020204d45524348414e544142494c495459206f72204649544e45535320464f52204120504152544943554c415220505552504f53452e2020536565207468650a2f2f20202020474e552047656e6572616c205075626c6963204c6963656e736520666f72206d6f72652064657461696c732e0a2f2f0a2f2f20202020596f752073686f756c642068617665207265636569766564206120636f7079206f662074686520474e552047656e6572616c205075626c6963204c6963656e73650a2f2f20202020616c6f6e67207769746820504f532d546563682e20204966206e6f742c20736565203c687474703a2f2f7777772e676e752e6f72672f6c6963656e7365732f3e2e0a0a2020202067726f7570203d206d656e752e61646447726f757028224d656e752e4d61696e22293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e5469636b6574222c202266722e70617374657175652e706f732e73616c65732e4a50616e656c5469636b657453616c657322293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e5469636b657445646974222c202266722e70617374657175652e706f732e73616c65732e4a50616e656c5469636b6574456469747322293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e437573746f6d6572735061796d656e74222c202266722e70617374657175652e706f732e637573746f6d6572732e437573746f6d6572735061796d656e7422293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e5061796d656e7473222c202266722e70617374657175652e706f732e70616e656c732e4a50616e656c5061796d656e747322293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e436c6f7365545056222c202266722e70617374657175652e706f732e70616e656c732e4a50616e656c436c6f73654d6f6e657922293b0a0a2020202067726f7570203d206d656e752e61646447726f757028224d656e752e4261636b6f666669636522293b0a2020202067726f75702e6164644261636b4f6666696365416374696f6e28293b0a2020202067726f7570203d206d656e752e61646447726f757028224d656e752e53797374656d22293b0a2020202067726f75702e6164644368616e676550617373776f7264416374696f6e28293b0a2020202067726f75702e61646450616e656c28226d656e755f73657474696e67732e706e67222c20224d656e752e436f6e66696775726174696f6e222c202266722e70617374657175652e706f732e636f6e6669672e4a50616e656c436f6e66696775726174696f6e22293b0a2020202067726f75702e61646450616e656c28226d656e755f7072696e7465722e706e67222c20224d656e752e5072696e746572222c202266722e70617374657175652e706f732e70616e656c732e4a50616e656c5072696e74657222293b0a2020202067726f75702e61646445786974416374696f6e28293b0a0a);
INSERT INTO LOCATIONS (`ID`, `NAME`, `ADDRESS`) VALUES ('0', 'Principal', NULL);
INSERT INTO CASHREGISTERS (`ID`, `NAME`, `LOCATION_ID`) VALUES (1, '', '0');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Standard category');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Compositions');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pre-payment');
INSERT INTO CURRENCIES(ID, NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES (1, 'Dollar', '$', ',', ' ', 1.0, '$#,##0.00', 1);
-- France default data
UPDATE CATEGORIES SET NAME = 'Categorie standard' WHERE ID = '000';
UPDATE CATEGORIES SET NAME = 'Formules' WHERE ID = '0';
UPDATE CATEGORIES SET NAME = 'Pré-paiement' WHERE ID = '-1';
UPDATE CURRENCIES SET NAME = 'Euro', SYMBOL = '€', DECIMALSEP = ',', THOUSANDSSEP = '.', FORMAT = '#,##0.00 $' WHERE ID = 1;
INSERT INTO LOCATIONS (`ID`, `NAME`, `ADDRESS`) VALUES ('0', 'Principal', NULL);
INSERT INTO CASHREGISTERS (`ID`, `NAME`, `LOCATION_ID`) VALUES (1, '', '0');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Catégorie standard');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Formules');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pré-paiement');
INSERT INTO CURRENCIES(NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES ('Euro', '€', ',', ' ', 1.0, '#,##0.00$', 1);
-- Taxes
INSERT INTO TAXCATEGORIES(ID, NAME) VALUES ('000', 'Sans TVA');
......
-- France default data
UPDATE CATEGORIES SET NAME = 'Categorie standard' WHERE ID = '000';
UPDATE CATEGORIES SET NAME = 'Formules' WHERE ID = '0';
UPDATE CATEGORIES SET NAME = 'Pré-paiement' WHERE ID = '-1';
UPDATE CURRENCIES SET NAME = 'Euro', SYMBOL = '€', DECIMALSEP = ',', THOUSANDSSEP = '.', FORMAT = '#,##0.00 $' WHERE ID = 1;
INSERT INTO LOCATIONS (`ID`, `NAME`, `ADDRESS`) VALUES ('0', 'Principal', NULL);
INSERT INTO CASHREGISTERS (`ID`, `NAME`, `LOCATION_ID`) VALUES (1, '', '0');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Catégorie standard');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Formules');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pré-paiement');
INSERT INTO CURRENCIES(NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES ('Euro', '€', ',', ' ', 1.0, '#,##0.00$', 1);
-- Taxes
INSERT INTO TAXCATEGORIES(ID, NAME) VALUES ('000', 'Sans TVA');
......
-- France default data
UPDATE CATEGORIES SET NAME = 'Categorie standard' WHERE ID = '000';
UPDATE CATEGORIES SET NAME = 'Formules' WHERE ID = '0';
UPDATE CATEGORIES SET NAME = 'Pré-paiement' WHERE ID = '-1';
UPDATE CURRENCIES SET NAME = 'Euro', SYMBOL = '€', DECIMALSEP = ',', THOUSANDSSEP = '.', FORMAT = '#,##0.00 $' WHERE ID = 1;
INSERT INTO LOCATIONS (`ID`, `NAME`, `ADDRESS`) VALUES ('0', 'Principal', NULL);
INSERT INTO CASHREGISTERS (`ID`, `NAME`, `LOCATION_ID`) VALUES (1, '', '0');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Catégorie standard');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Formules');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pré-paiement');
INSERT INTO CURRENCIES(NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES ('Euro', '€', ',', ' ', 1.0, '#,##0.00$', 1);
-- Taxes
INSERT INTO TAXCATEGORIES(ID, NAME) VALUES ('000', 'Sans TVA');
......
-- United Kingdoms default data
UPDATE CURRENCIES SET NAME = 'Pound', SYMBOL = '£', DECIMALSEP = '.', THOUSANDSSEP = NULL, FORMAT = '$#0.00' WHERE ID = 1;
INSERT INTO LOCATIONS (`ID`, `NAME`, `ADDRESS`) VALUES ('0', 'Principal', NULL);
INSERT INTO CASHREGISTERS (`ID`, `NAME`, `LOCATION_ID`) VALUES (1, '', '0');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Standard category');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Compositions');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pre-payment');
INSERT INTO CURRENCIES(NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES ('Pound', '£', '.', ' ', 1.0, '$#0.00', 1);
-- Taxes
INSERT INTO TAXCATEGORIES(ID, NAME) VALUES ('000', 'Zero VAT');
......
......@@ -481,10 +481,3 @@ INSERT INTO RESOURCES (ID, NAME, RESTYPE, CONTENT) VALUES
('11', 'Ticket.Buttons', 0, '\x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e0a3c212d2d200a202020204f70656e627261766f20504f53206973206120706f696e74206f662073616c6573206170706c69636174696f6e2064657369676e656420666f7220746f7563682073637265656e732e0a20202020436f707972696768742028432920323030382d32303039204f70656e627261766f2c20532e4c2e0a20202020687474703a2f2f736f75726365666f7267652e6e65742f70726f6a656374732f6f70656e627261766f706f730a0a20202020546869732066696c652069732070617274206f66204f70656e627261766f20504f532e0a0a202020204f70656e627261766f20504f53206973206672656520736f6674776172653a20796f752063616e2072656469737472696275746520697420616e642f6f72206d6f646966790a20202020697420756e64657220746865207465726d73206f662074686520474e552047656e6572616c205075626c6963204c6963656e7365206173207075626c69736865642062790a20202020746865204672656520536f66747761726520466f756e646174696f6e2c206569746865722076657273696f6e2033206f6620746865204c6963656e73652c206f720a2020202028617420796f7572206f7074696f6e2920616e79206c617465722076657273696f6e2e0a0a202020204f70656e627261766f20504f5320697320646973747269627574656420696e2074686520686f706520746861742069742077696c6c2062652075736566756c2c0a2020202062757420574954484f555420414e592057415252414e54593b20776974686f7574206576656e2074686520696d706c6965642077617272616e7479206f660a202020204d45524348414e544142494c495459206f72204649544e45535320464f52204120504152544943554c415220505552504f53452e2020536565207468650a20202020474e552047656e6572616c205075626c6963204c6963656e736520666f72206d6f72652064657461696c732e0a0a20202020596f752073686f756c642068617665207265636569766564206120636f7079206f662074686520474e552047656e6572616c205075626c6963204c6963656e73650a20202020616c6f6e672077697468204f70656e627261766f20504f532e20204966206e6f742c20736565203c687474703a2f2f7777772e676e752e6f72672f6c6963656e7365732f3e2e0a202d2d3e0a3c636f6e66696775726174696f6e3e0a202020203c627574746f6e206b65793d22627574746f6e2e7072696e7422207469746c656b65793d22627574746f6e2e7072696e74222074656d706c6174653d225072696e7465722e5469636b657450726576696577222f3e0a202020203c627574746f6e206b65793d22627574746f6e2e6f70656e64726177657222207469746c656b65793d22627574746f6e2e6f70656e647261776572222074656d706c6174653d225072696e7465722e4f70656e447261776572222f3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e6368616e67652220636f64653d226576656e742e6368616e6765222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e6164646c696e652220636f64653d226576656e742e6164646c696e65222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e72656d6f76656c696e652220636f64653d226576656e742e72656d6f76656c696e65222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e7365746c696e652220636f64653d226576656e742e7365746c696e65222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e73686f772220636f64653d226576656e742e73686f77222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e746f74616c2220636f64653d226576656e742e746f74616c222f3e202d2d3e0a202020203c212d2d203c6576656e74206b65793d227469636b65742e636c6f73652220636f64653d226576656e742e636c6f7365222f3e202d2d3e2020200a202020203c696d672d77696474682076616c75653d22313238222f3e0a202020203c696d672d6865696768742076616c75653d223634222f3e0a202020203c6361742d6865696768742076616c75653d2233303022202f3e0a202020203c7461786573696e636c756465642076616c75653d2266616c7365222f3e2020200a202020203c212d2d203c7072696e7473656c65637465642076616c75653d2274727565222f3e202d2d3e202020200a202020203c212d2d203c74617863617465676f727969642076616c75653d22303031222f3e202d2d3e0a202020203c212d2d203c707269636576697369626c652076616c75653d227472756522202f3e202d2d3e0a3c2f636f6e66696775726174696f6e3e0a'),
('12', 'Ticket.Line', 0, '\x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e0a3c212d2d200a202020204f70656e627261766f20504f53206973206120706f696e74206f662073616c6573206170706c69636174696f6e2064657369676e656420666f7220746f7563682073637265656e732e0a20202020436f707972696768742028432920323030372d32303039204f70656e627261766f2c20532e4c2e0a20202020687474703a2f2f736f75726365666f7267652e6e65742f70726f6a656374732f6f70656e627261766f706f730a0a20202020546869732066696c652069732070617274206f66204f70656e627261766f20504f532e0a0a202020204f70656e627261766f20504f53206973206672656520736f6674776172653a20796f752063616e2072656469737472696275746520697420616e642f6f72206d6f646966790a20202020697420756e64657220746865207465726d73206f662074686520474e552047656e6572616c205075626c6963204c6963656e7365206173207075626c69736865642062790a20202020746865204672656520536f66747761726520466f756e646174696f6e2c206569746865722076657273696f6e2033206f6620746865204c6963656e73652c206f720a2020202028617420796f7572206f7074696f6e2920616e79206c617465722076657273696f6e2e0a0a202020204f70656e627261766f20504f5320697320646973747269627574656420696e2074686520686f706520746861742069742077696c6c2062652075736566756c2c0a2020202062757420574954484f555420414e592057415252414e54593b20776974686f7574206576656e2074686520696d706c6965642077617272616e7479206f660a202020204d45524348414e544142494c495459206f72204649544e45535320464f52204120504152544943554c415220505552504f53452e2020536565207468650a20202020474e552047656e6572616c205075626c6963204c6963656e736520666f72206d6f72652064657461696c732e0a0a20202020596f752073686f756c642068617665207265636569766564206120636f7079206f662074686520474e552047656e6572616c205075626c6963204c6963656e73650a20202020616c6f6e672077697468204f70656e627261766f20504f532e20204966206e6f742c20736565203c687474703a2f2f7777772e676e752e6f72672f6c6963656e7365732f3e2e0a202d2d3e0a0a3c6c696e653e0a202020203c636f6c756d6e206e616d653d226c6162656c2e6974656d222077696474683d223132352220616c69676e3d226c656674222076616c75653d22266c743b68746d6c2667743b2369662028247469636b65746c696e652e697350726f64756374436f6d28292920266c743b692667743b2a26616d703b6e6273703b26616d703b6e6273703b247b7469636b65746c696e652e7072696e744e616d6528297d266c743b2f692667743b2023656c736520247b7469636b65746c696e652e7072696e744e616d6528297d2023656e64266c743b62722667743b247b7469636b65746c696e652e67657450726f64756374417474536574496e73744465736328297d222f3e0a202020203c636f6c756d6e206e616d653d226c6162656c2e7072696365222077696474683d2238302220616c69676e3d227269676874222076616c75653d22247b7469636b65746c696e652e7072696e74507269636554617828297d222f3e0a202020203c636f6c756d6e206e616d653d226c6162656c2e756e697473222077696474683d2235302220616c69676e3d227269676874222076616c75653d2278247b7469636b65746c696e652e7072696e744d756c7469706c7928297d222f3e0a202020203c636f6c756d6e206e616d653d226c6162656c2e76616c7565222077696474683d2238302220616c69676e3d227269676874222076616c75653d22247b7469636b65746c696e652e7072696e7456616c756528297d222f3e0a3c2f6c696e653e'),
('14', 'Menu.Root', 0, '\x2f2f20202020504f532d546563680a2f2f2020202042617365642075706f6e204f70656e627261766f20504f530a2f2f0a2f2f20202020436f707972696768742028432920323030372d32303039204f70656e627261766f2c20532e4c2e0a2f2f202020202020202020202020202020202020202020202032303132205341524c2053434f4f50205363696c2028687474703a2f2f7363696c2e636f6f70290a2f2f0a2f2f20202020546869732066696c652069732070617274206f6620504f532d546563682e0a2f2f0a2f2f20202020504f532d54656368206973206672656520736f6674776172653a20796f752063616e2072656469737472696275746520697420616e642f6f72206d6f646966790a2f2f20202020697420756e64657220746865207465726d73206f662074686520474e552047656e6572616c205075626c6963204c6963656e7365206173207075626c69736865642062790a2f2f20202020746865204672656520536f66747761726520466f756e646174696f6e2c206569746865722076657273696f6e2033206f6620746865204c6963656e73652c206f720a2f2f2020202028617420796f7572206f7074696f6e2920616e79206c617465722076657273696f6e2e0a2f2f0a2f2f20202020504f532d5465636820697320646973747269627574656420696e2074686520686f706520746861742069742077696c6c2062652075736566756c2c0a2f2f2020202062757420574954484f555420414e592057415252414e54593b20776974686f7574206576656e2074686520696d706c6965642077617272616e7479206f660a2f2f202020204d45524348414e544142494c495459206f72204649544e45535320464f52204120504152544943554c415220505552504f53452e2020536565207468650a2f2f20202020474e552047656e6572616c205075626c6963204c6963656e736520666f72206d6f72652064657461696c732e0a2f2f0a2f2f20202020596f752073686f756c642068617665207265636569766564206120636f7079206f662074686520474e552047656e6572616c205075626c6963204c6963656e73650a2f2f20202020616c6f6e67207769746820504f532d546563682e20204966206e6f742c20736565203c687474703a2f2f7777772e676e752e6f72672f6c6963656e7365732f3e2e0a0a2020202067726f7570203d206d656e752e61646447726f757028224d656e752e4d61696e22293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e5469636b6574222c202266722e70617374657175652e706f732e73616c65732e4a50616e656c5469636b657453616c657322293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e5469636b657445646974222c202266722e70617374657175652e706f732e73616c65732e4a50616e656c5469636b6574456469747322293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e437573746f6d6572735061796d656e74222c202266722e70617374657175652e706f732e637573746f6d6572732e437573746f6d6572735061796d656e7422293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e5061796d656e7473222c202266722e70617374657175652e706f732e70616e656c732e4a50616e656c5061796d656e747322293b0a2020202067726f75702e61646450616e656c28226d656e755f67656e657269632e706e67222c20224d656e752e436c6f7365545056222c202266722e70617374657175652e706f732e70616e656c732e4a50616e656c436c6f73654d6f6e657922293b0a0a2020202067726f7570203d206d656e752e61646447726f757028224d656e752e4261636b6f666669636522293b0a2020202067726f75702e6164644261636b4f6666696365416374696f6e28293b0a2020202067726f7570203d206d656e752e61646447726f757028224d656e752e53797374656d22293b0a2020202067726f75702e6164644368616e676550617373776f7264416374696f6e28293b0a2020202067726f75702e61646450616e656c28226d656e755f73657474696e67732e706e67222c20224d656e752e436f6e66696775726174696f6e222c202266722e70617374657175652e706f732e636f6e6669672e4a50616e656c436f6e66696775726174696f6e22293b0a2020202067726f75702e61646450616e656c28226d656e755f7072696e7465722e706e67222c20224d656e752e5072696e746572222c202266722e70617374657175652e706f732e70616e656c732e4a50616e656c5072696e74657222293b0a2020202067726f75702e61646445786974416374696f6e28293b0a0a');
INSERT INTO LOCATIONS (ID, NAME, ADDRESS) VALUES ('0', 'Principal', NULL);
INSERT INTO CASHREGISTERS (ID, NAME, LOCATION_ID) VALUES (1, '', '0');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Standard category');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Compositions');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pre-payment');
INSERT INTO CURRENCIES(ID, NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES (1, 'Dollar', '$', ',', ' ', 1.0, '$#,##0.00', True);
-- France default data
INSERT INTO LOCATIONS (ID, NAME, ADDRESS) VALUES ('0', 'Principal', NULL);
UPDATE CATEGORIES SET NAME = 'Categorie standard' WHERE ID = '000';
UPDATE CATEGORIES SET NAME = 'Formules' WHERE ID = '0';
UPDATE CATEGORIES SET NAME = 'Pré-paiement' WHERE ID = '-1';
INSERT INTO CASHREGISTERS (ID, NAME, LOCATION_ID) VALUES (1, '', '0');
UPDATE CURRENCIES SET NAME = 'Euro', SYMBOL = '€', DECIMALSEP = ',', THOUSANDSSEP = '.', FORMAT = '#,##0.00 $' WHERE ID = 1;
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Catégorie standard');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Formules');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pré-paiement');
INSERT INTO CURRENCIES(NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES ('Euro', '€', '.', ' ', 1.0, '$#,##0.00', True);
-- Taxes
INSERT INTO TAXCATEGORIES(ID, NAME) VALUES ('000', 'Sans TVA');
......
-- France default data
INSERT INTO LOCATIONS (ID, NAME, ADDRESS) VALUES ('0', 'Principal', NULL);
UPDATE CATEGORIES SET NAME = 'Categorie standard' WHERE ID = '000';
UPDATE CATEGORIES SET NAME = 'Formules' WHERE ID = '0';
UPDATE CATEGORIES SET NAME = 'Pré-paiement' WHERE ID = '-1';
INSERT INTO CASHREGISTERS (ID, NAME, LOCATION_ID) VALUES (1, '', '0');
UPDATE CURRENCIES SET NAME = 'Euro', SYMBOL = '€', DECIMALSEP = ',', THOUSANDSSEP = '.', FORMAT = '#,##0.00 $' WHERE ID = 1;
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Catégorie standard');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Formules');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pré-paiement');
INSERT INTO CURRENCIES(NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES ('Euro', '€', '.', ' ', 1.0, '$#,##0.00', True);
-- Taxes
INSERT INTO TAXCATEGORIES(ID, NAME) VALUES ('000', 'Sans TVA');
......
-- France default data
INSERT INTO LOCATIONS (ID, NAME, ADDRESS) VALUES ('0', 'Principal', NULL);
UPDATE CATEGORIES SET NAME = 'Categorie standard' WHERE ID = '000';
UPDATE CATEGORIES SET NAME = 'Formules' WHERE ID = '0';
UPDATE CATEGORIES SET NAME = 'Pré-paiement' WHERE ID = '-1';
INSERT INTO CASHREGISTERS (ID, NAME, LOCATION_ID) VALUES (1, '', '0');
UPDATE CURRENCIES SET NAME = 'Euro', SYMBOL = '€', DECIMALSEP = ',', THOUSANDSSEP = '.', FORMAT = '#,##0.00 $' WHERE ID = 1;
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Catégorie standard');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Formules');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pré-paiement');
INSERT INTO CURRENCIES(NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES ('Euro', '€', '.', ' ', 1.0, '$#,##0.00', True);
-- Taxes
INSERT INTO TAXCATEGORIES(ID, NAME) VALUES ('000', 'Sans TVA');
......
-- France default data
-- UK default data
INSERT INTO LOCATIONS (ID, NAME, ADDRESS) VALUES ('0', 'Principal', NULL);
UPDATE CURRENCIES SET NAME = 'Pound', SYMBOL = '£', DECIMALSEP = '.', THOUSANDSSEP = NULL, FORMAT = '$#0.00' WHERE ID = 1;
INSERT INTO CASHREGISTERS (ID, NAME, LOCATION_ID) VALUES (1, '', '0');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('000', 'Standard category');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('0', 'Compositions');
INSERT INTO CATEGORIES(ID, NAME) VALUES ('-1', 'Pre-payment');
INSERT INTO CURRENCIES(NAME, SYMBOL, DECIMALSEP, THOUSANDSSEP, RATE, FORMAT, MAIN) VALUES ('Pound', '£', '.', ',', 1.0, '$#0.00', True);
-- Taxes
INSERT INTO TAXCATEGORIES(ID, NAME) VALUES ('000', 'Zero VAT');
......
......@@ -23,29 +23,29 @@ require_once(dirname(dirname(__FILE__)) . "/common_load.php");
class CashRegistersAPITest extends \PHPUnit_Framework_TestCase {
public static function setUpBeforeClass() {
// Install empty database
Installer::install(null);
private $location;
protected function setUp() {
$srv = new LocationsService();
$location = new Location("Location");
$location->id = $srv->create($location);
$this->location = $location;
}
protected function tearDown() {
// Restore database in its empty state
$pdo = PDOBuilder::getPDO();
if ($pdo->exec("DELETE FROM CASHREGISTERS") === false) {
if ($pdo->exec("DELETE FROM CASHREGISTERS") === false
|| $pdo->exec("DELETE FROM LOCATIONS") === false) {
echo("[ERROR] Unable to restore db\n");
}
}
public static function tearDownAfterClass() {
// Erase database
dropDatabase();
}
public function testGetById() {
$broker = new APIBroker("CashRegistersAPI");
$srv = new CashRegistersService();
// Init cash register
$cashReg = new CashRegister("Cash", "0", 1);
$cashReg = new CashRegister("Cash", $this->location->id, 1);
$id = $srv->create($cashReg);
// Get it through API
$result = $broker->run("get", array("id" => $id));
......@@ -57,8 +57,6 @@ class CashRegistersAPITest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($cashReg->label, $content->label, "Label mismatch");
$this->assertEquals($cashReg->locationId, $content->locationId,
"Location id mismatch");
$this->assertEquals($cashReg->posId, $content->posId,
"POS id mismatch");
}
public function testGetInexistentId() {
......@@ -70,5 +68,4 @@ class CashRegistersAPITest extends \PHPUnit_Framework_TestCase {
$this->assertNull($content, "Content is not null");
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -23,28 +23,27 @@ require_once(dirname(dirname(__FILE__)) . "/common_load.php");
class CashRegistersServiceTest extends \PHPUnit_Framework_TestCase {
public static function setUpBeforeClass() {
// Install empty database
Installer::install(null);
private $location;
protected function setUp() {
$srv = new LocationsService();
$location = new Location("Location");
$location->id = $srv->create($location);
$this->location = $location;
}
protected function tearDown() {
// Restore database in its empty state
$pdo = PDOBuilder::getPDO();
if ($pdo->exec("DELETE FROM CASHREGISTERS") === false) {
if ($pdo->exec("DELETE FROM CASHREGISTERS") === false
|| $pdo->exec("DELETE FROM LOCATIONS") === false) {
echo("[ERROR] Unable to restore db\n");
}
}
public static function tearDownAfterClass() {
// Erase database
dropDatabase();
}
public function testCreate() {
$type = get_db_type(get_user_id());
$srv = new CashRegistersService();
$cashReg = new CashRegister("CashReg", "0", 1);
$cashReg = new CashRegister("CashReg", $this->location->id);
$id = $srv->create($cashReg);
$this->assertNotEquals(false, $id, "Insertion failed");
$pdo = PDOBuilder::getPDO();
......@@ -57,20 +56,18 @@ class CashRegistersServiceTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($cashReg->label, $row['NAME'], "Label mismatch");
$this->assertEquals($cashReg->locationId, $row['LOCATION_ID'],
"Location id mismatch");
$this->assertEquals($cashReg->posId, $row['POS_ID'], "POS id mismatch");
}
/** @depends testCreate */
public function testGet() {
$srv = new CashRegistersService();
$cashReg = new CashRegister("CashReg", "0", 1);
$cashReg = new CashRegister("CashReg", $this->location->id, 1);
$id = $srv->create($cashReg);
$read = $srv->get($id);
$this->assertEquals($id, $read->id, "Id mismatch");
$this->assertEquals($cashReg->label, $read->label, "Label mismatch");
$this->assertEquals($cashReg->locationId, $read->locationId,
"Location id mismatch");
$this->assertEquals($cashReg->posId, $read->posId, "POS id mismatch");
}
public function testGetInexistent() {
......@@ -88,6 +85,4 @@ class CashRegistersServiceTest extends \PHPUnit_Framework_TestCase {
public function testDelete() {
$this->markTestIncomplete();
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
Supports Markdown
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