Compare commits
3 Commits
84e2b419c8
...
a2e103c32f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2e103c32f | ||
|
|
2f4461f8d9 | ||
|
|
5b56197aaa |
@@ -16,11 +16,17 @@ use Domframework\Dbjson;
|
|||||||
*/
|
*/
|
||||||
class DbjsonTest extends \PHPUnit_Framework_TestCase
|
class DbjsonTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
private $DBFILE;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->DBFILE = "/tmp/dbjson-" . time();
|
||||||
|
}
|
||||||
|
|
||||||
public function testInsertOne1()
|
public function testInsertOne1()
|
||||||
{
|
{
|
||||||
// Document #0
|
// Document #0
|
||||||
define("dbfile", "/tmp/dbjson-" . time());
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
|
||||||
$res = $dbjson->insertOne(
|
$res = $dbjson->insertOne(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => "val1", "key2" => "val2"]
|
["key1" => "val1", "key2" => "val2"]
|
||||||
@@ -31,7 +37,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testInsertOne2()
|
public function testInsertOne2()
|
||||||
{
|
{
|
||||||
// Document #1
|
// Document #1
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->insertOne(
|
$res = $dbjson->insertOne(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => "val1", "key2" => "val2"]
|
["key1" => "val1", "key2" => "val2"]
|
||||||
@@ -43,7 +49,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// Error : Invalid array provided (not array of array)
|
// Error : Invalid array provided (not array of array)
|
||||||
$this->setExpectedException("Exception");
|
$this->setExpectedException("Exception");
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->insertMany(
|
$res = $dbjson->insertMany(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => "val1", "key2" => "val2"]
|
["key1" => "val1", "key2" => "val2"]
|
||||||
@@ -53,7 +59,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testInsertMany2()
|
public function testInsertMany2()
|
||||||
{
|
{
|
||||||
// Document #2 and #3
|
// Document #2 and #3
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->insertMany(
|
$res = $dbjson->insertMany(
|
||||||
"collection",
|
"collection",
|
||||||
[["key1" => "val3", "key2" => "val2"],
|
[["key1" => "val3", "key2" => "val2"],
|
||||||
@@ -65,21 +71,21 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testFilter1()
|
public function testFilter1()
|
||||||
{
|
{
|
||||||
// Return all the keys (filter = array ())
|
// Return all the keys (filter = array ())
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->filter("collection", []);
|
$res = $dbjson->filter("collection", []);
|
||||||
$this->assertSame(array_keys($res), [0,1,2,3]);
|
$this->assertSame(array_keys($res), [0,1,2,3]);
|
||||||
}
|
}
|
||||||
public function testFilter2()
|
public function testFilter2()
|
||||||
{
|
{
|
||||||
// Return the keys where filter = array ("key2"=>"val2"))
|
// Return the keys where filter = array ("key2"=>"val2"))
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->filter("collection", ["key2" => "val2"]);
|
$res = $dbjson->filter("collection", ["key2" => "val2"]);
|
||||||
$this->assertSame(array_keys($res), [0,1,2]);
|
$this->assertSame(array_keys($res), [0,1,2]);
|
||||||
}
|
}
|
||||||
public function testFilter3()
|
public function testFilter3()
|
||||||
{
|
{
|
||||||
// Return the keys where filter = array ("key1"=>"val3","key2"=>"val2"))
|
// Return the keys where filter = array ("key1"=>"val3","key2"=>"val2"))
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->filter("collection", ["key1" => "val3",
|
$res = $dbjson->filter("collection", ["key1" => "val3",
|
||||||
"key2" => "val2"]);
|
"key2" => "val2"]);
|
||||||
$this->assertSame(count($res), 1);
|
$this->assertSame(count($res), 1);
|
||||||
@@ -88,7 +94,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// Return the keys where filter = array ("key1"=>array ("val3", "=="),
|
// Return the keys where filter = array ("key1"=>array ("val3", "=="),
|
||||||
// "key2"=>array ("val2", "=="))
|
// "key2"=>array ("val2", "=="))
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->filter("collection", ["key1" => ["val3", "=="],
|
$res = $dbjson->filter("collection", ["key1" => ["val3", "=="],
|
||||||
"key2" => ["val2", "=="]]);
|
"key2" => ["val2", "=="]]);
|
||||||
$this->assertSame(count($res), 1);
|
$this->assertSame(count($res), 1);
|
||||||
@@ -97,7 +103,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// Return the keys where filter = array ("key1"=>array ("val3", "<="),
|
// Return the keys where filter = array ("key1"=>array ("val3", "<="),
|
||||||
// "key2"=>array ("val2", "=="))
|
// "key2"=>array ("val2", "=="))
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->filter("collection", ["key1" => ["val3", "<="],
|
$res = $dbjson->filter("collection", ["key1" => ["val3", "<="],
|
||||||
"key2" => ["val2", "=="]]);
|
"key2" => ["val2", "=="]]);
|
||||||
$this->assertSame(array_keys($res), [0,1,2]);
|
$this->assertSame(array_keys($res), [0,1,2]);
|
||||||
@@ -106,7 +112,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// Return the keys where filter = array ("key1"=>array ("val3", "<="),
|
// Return the keys where filter = array ("key1"=>array ("val3", "<="),
|
||||||
// "key2"=>array ("val2", ">"))
|
// "key2"=>array ("val2", ">"))
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->filter("collection", ["key1" => ["val3", "<="],
|
$res = $dbjson->filter("collection", ["key1" => ["val3", "<="],
|
||||||
"key2" => ["val2", ">"]]);
|
"key2" => ["val2", ">"]]);
|
||||||
$this->assertSame(count($res), 1);
|
$this->assertSame(count($res), 1);
|
||||||
@@ -114,7 +120,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testFind1()
|
public function testFind1()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find("collection", ["key1" => ["val3", "<="],
|
$res = $dbjson->find("collection", ["key1" => ["val3", "<="],
|
||||||
"key2" => ["val2", ">"]]);
|
"key2" => ["val2", ">"]]);
|
||||||
$res = array_values($res);
|
$res = array_values($res);
|
||||||
@@ -125,7 +131,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind2()
|
public function testFind2()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -142,7 +148,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// Exception : fields not an array
|
// Exception : fields not an array
|
||||||
$this->setExpectedException("Exception");
|
$this->setExpectedException("Exception");
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -152,7 +158,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind4()
|
public function testFind4()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -166,7 +172,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind5()
|
public function testFind5()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -181,7 +187,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind6()
|
public function testFind6()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -202,7 +208,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind7()
|
public function testFind7()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -220,7 +226,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind8()
|
public function testFind8()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -236,7 +242,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDeleteOne1()
|
public function testDeleteOne1()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->deleteOne(
|
$res = $dbjson->deleteOne(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -247,7 +253,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind9()
|
public function testFind9()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -264,7 +270,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDeleteMany1()
|
public function testDeleteMany1()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->deleteMany(
|
$res = $dbjson->deleteMany(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -275,7 +281,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind10()
|
public function testFind10()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->find(
|
$res = $dbjson->find(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => ["val3", "<="],
|
["key1" => ["val3", "<="],
|
||||||
@@ -290,7 +296,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testFind11()
|
public function testFind11()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = array_values($dbjson->find("collection"));
|
$res = array_values($dbjson->find("collection"));
|
||||||
// ["_id"] is random : skip the test
|
// ["_id"] is random : skip the test
|
||||||
unset($res[0]["_id"]);
|
unset($res[0]["_id"]);
|
||||||
@@ -299,13 +305,13 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testReplace1()
|
public function testReplace1()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->replace("collection", [], ["key2" => "val5"]);
|
$res = $dbjson->replace("collection", [], ["key2" => "val5"]);
|
||||||
$this->assertSame($res, 1);
|
$this->assertSame($res, 1);
|
||||||
}
|
}
|
||||||
public function testFind12()
|
public function testFind12()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = array_values($dbjson->find("collection"));
|
$res = array_values($dbjson->find("collection"));
|
||||||
// ["_id"] is random : skip the test
|
// ["_id"] is random : skip the test
|
||||||
unset($res[0]["_id"]);
|
unset($res[0]["_id"]);
|
||||||
@@ -314,14 +320,14 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testUpdate1()
|
public function testUpdate1()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->update("collection", [], ["key2" => "val6",
|
$res = $dbjson->update("collection", [], ["key2" => "val6",
|
||||||
"key5" => "val5"]);
|
"key5" => "val5"]);
|
||||||
$this->assertSame($res, 1);
|
$this->assertSame($res, 1);
|
||||||
}
|
}
|
||||||
public function testFind13()
|
public function testFind13()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = array_values($dbjson->find("collection"));
|
$res = array_values($dbjson->find("collection"));
|
||||||
// ["_id"] is random : skip the test
|
// ["_id"] is random : skip the test
|
||||||
unset($res[0]["_id"]);
|
unset($res[0]["_id"]);
|
||||||
@@ -331,7 +337,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testInsertOne3()
|
public function testInsertOne3()
|
||||||
{
|
{
|
||||||
// Document #4
|
// Document #4
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->insertOne(
|
$res = $dbjson->insertOne(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => "val1", "key2" => "val2"]
|
["key1" => "val1", "key2" => "val2"]
|
||||||
@@ -340,7 +346,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind14()
|
public function testFind14()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = array_values($dbjson->find("collection"));
|
$res = array_values($dbjson->find("collection"));
|
||||||
// ["_id"] is random : skip the test
|
// ["_id"] is random : skip the test
|
||||||
unset($res[0]["_id"]);
|
unset($res[0]["_id"]);
|
||||||
@@ -353,14 +359,14 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testUpdate2()
|
public function testUpdate2()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->update("collection", [], ["key2" => "val7",
|
$res = $dbjson->update("collection", [], ["key2" => "val7",
|
||||||
"key5" => "val8"]);
|
"key5" => "val8"]);
|
||||||
$this->assertSame($res, 2);
|
$this->assertSame($res, 2);
|
||||||
}
|
}
|
||||||
public function testFind15()
|
public function testFind15()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = array_values($dbjson->find("collection"));
|
$res = array_values($dbjson->find("collection"));
|
||||||
// ["_id"] is random : skip the test
|
// ["_id"] is random : skip the test
|
||||||
unset($res[0]["_id"]);
|
unset($res[0]["_id"]);
|
||||||
@@ -374,7 +380,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testUpdate3()
|
public function testUpdate3()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = $dbjson->update(
|
$res = $dbjson->update(
|
||||||
"collection",
|
"collection",
|
||||||
[],
|
[],
|
||||||
@@ -386,7 +392,7 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
public function testFind16()
|
public function testFind16()
|
||||||
{
|
{
|
||||||
$dbjson = new Dbjson("dbjson://" . dbfile);
|
$dbjson = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$res = array_values($dbjson->find("collection"));
|
$res = array_values($dbjson->find("collection"));
|
||||||
// ["_id"] is random : skip the test
|
// ["_id"] is random : skip the test
|
||||||
unset($res[0]["_id"]);
|
unset($res[0]["_id"]);
|
||||||
@@ -399,8 +405,8 @@ class DbjsonTest extends \PHPUnit_Framework_TestCase
|
|||||||
// Concurrency tests
|
// Concurrency tests
|
||||||
public function testConcurrency1()
|
public function testConcurrency1()
|
||||||
{
|
{
|
||||||
$dbjson1 = new Dbjson("dbjson://" . dbfile);
|
$dbjson1 = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$dbjson2 = new Dbjson("dbjson://" . dbfile);
|
$dbjson2 = new Dbjson("dbjson://" . $this->DBFILE);
|
||||||
$dbjson1->insertOne(
|
$dbjson1->insertOne(
|
||||||
"collection",
|
"collection",
|
||||||
["key1" => "val1", "key2" => "val2"]
|
["key1" => "val1", "key2" => "val2"]
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ namespace Domframework\Tests;
|
|||||||
|
|
||||||
use Domframework\Dblayer;
|
use Domframework\Dblayer;
|
||||||
|
|
||||||
class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
class DblayerTestENGINE extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
// Test with column name 'group', 'object', 'where', 'with space'
|
// Test with column name 'group', 'object', 'where', 'with space'
|
||||||
// Test with table name 'group', 'object', 'where', 'with space'
|
// Test with table name 'group', 'object', 'where', 'with space'
|
||||||
// For the 3 DB engines
|
// For the 3 DB engines
|
||||||
|
|
||||||
public $engine = "{ENGINE}";
|
public $engine = "ENGINE";
|
||||||
public $confs = [
|
public $confs = [
|
||||||
"sqlite" => [
|
"sqlite" => [
|
||||||
"dsn" => "sqlite:/tmp/databaseDBLayer.db",
|
"dsn" => "sqlite:/tmp/databaseDBLayer.db",
|
||||||
@@ -47,7 +47,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDropTable()
|
public function testDropTable()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -75,7 +75,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
public function testCreateTable1()
|
public function testCreateTable1()
|
||||||
{
|
{
|
||||||
// Create a table named grouped
|
// Create a table named grouped
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -99,7 +99,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInsert1()
|
public function testInsert1()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -123,7 +123,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testRead1()
|
public function testRead1()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -148,7 +148,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testUpdate1()
|
public function testUpdate1()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -170,7 +170,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testRead2()
|
public function testRead2()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -195,7 +195,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testUpdate2()
|
public function testUpdate2()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -218,7 +218,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testRead3()
|
public function testRead3()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -243,7 +243,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testUpdate3()
|
public function testUpdate3()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -277,7 +277,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
public function testCreateTable2()
|
public function testCreateTable2()
|
||||||
{
|
{
|
||||||
// Create a table named group
|
// Create a table named group
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -306,7 +306,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testInsert2()
|
public function testInsert2()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -335,7 +335,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
// Test the unique feature
|
// Test the unique feature
|
||||||
public function testInsert3()
|
public function testInsert3()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -362,7 +362,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testInsert4()
|
public function testInsert4()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -395,7 +395,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Create a table named group
|
// Create a table named group
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -432,7 +432,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
public function testCreateTable3()
|
public function testCreateTable3()
|
||||||
{
|
{
|
||||||
// Create a table named group
|
// Create a table named group
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -454,7 +454,7 @@ class DblayerTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testReadOR1()
|
public function testReadOR1()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayer(
|
$db = new Dblayer(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ namespace Domframework\Tests;
|
|||||||
|
|
||||||
use Domframework\Dblayeroo;
|
use Domframework\Dblayeroo;
|
||||||
|
|
||||||
class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
class DblayerooTestENGINE extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
// Test with column name 'group', 'object', 'where', 'with space'
|
// Test with column name 'group', 'object', 'where', 'with space'
|
||||||
// Test with table name 'group', 'object', 'where', 'with space'
|
// Test with table name 'group', 'object', 'where', 'with space'
|
||||||
// For the 3 DB engines
|
// For the 3 DB engines
|
||||||
|
|
||||||
public $engine = "{ENGINE}";
|
public $engine = "ENGINE";
|
||||||
public $confs = [
|
public $confs = [
|
||||||
"sqlite" => [
|
"sqlite" => [
|
||||||
"dsn" => "sqlite:/tmp/databaseDBLayeroo.db",
|
"dsn" => "sqlite:/tmp/databaseDBLayeroo.db",
|
||||||
@@ -44,7 +44,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
private function tbl1()
|
private function tbl1()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$tbl1 = new Dblayeroo(
|
$tbl1 = new Dblayeroo(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -64,7 +64,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
private function tbl2()
|
private function tbl2()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$tbl2 = new Dblayeroo(
|
$tbl2 = new Dblayeroo(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -86,7 +86,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
private function tbl3()
|
private function tbl3()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$tbl3 = new Dblayeroo(
|
$tbl3 = new Dblayeroo(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -98,7 +98,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
private function tbl4()
|
private function tbl4()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$tbl4 = new Dblayeroo(
|
$tbl4 = new Dblayeroo(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -119,7 +119,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDropTable()
|
public function testDropTable()
|
||||||
{
|
{
|
||||||
$dbconfig = $this->confs["{ENGINE}"];
|
$dbconfig = $this->confs["ENGINE"];
|
||||||
$db = new Dblayeroo(
|
$db = new Dblayeroo(
|
||||||
$dbconfig["dsn"],
|
$dbconfig["dsn"],
|
||||||
$dbconfig["username"],
|
$dbconfig["username"],
|
||||||
@@ -1250,7 +1250,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_integerPositive",
|
"checkRealTypeIntegerPositive",
|
||||||
"1",
|
"1",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1261,7 +1261,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_integerPositive",
|
"checkRealTypeIntegerPositive",
|
||||||
"-1",
|
"-1",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1273,7 +1273,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_integerPositive",
|
"checkRealTypeIntegerPositive",
|
||||||
"0777",
|
"0777",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1285,7 +1285,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_integerPositive",
|
"checkRealTypeIntegerPositive",
|
||||||
"07a7",
|
"07a7",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1298,7 +1298,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_allowedchars",
|
"checkRealTypeAllowedchars",
|
||||||
"1111",
|
"1111",
|
||||||
"allowedchars(123)"
|
"allowedchars(123)"
|
||||||
);
|
);
|
||||||
@@ -1309,7 +1309,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_allowedchars",
|
"checkRealTypeAllowedchars",
|
||||||
"-1",
|
"-1",
|
||||||
"allowedchars(123)"
|
"allowedchars(123)"
|
||||||
);
|
);
|
||||||
@@ -1321,7 +1321,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_array",
|
"checkRealTypeArray",
|
||||||
"235",
|
"235",
|
||||||
"array('123','235','256')"
|
"array('123','235','256')"
|
||||||
);
|
);
|
||||||
@@ -1332,7 +1332,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_array",
|
"checkRealTypeArray",
|
||||||
"777",
|
"777",
|
||||||
"array('123','235','256')"
|
"array('123','235','256')"
|
||||||
);
|
);
|
||||||
@@ -1344,7 +1344,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_regex",
|
"checkRealTypeRegex",
|
||||||
"235",
|
"235",
|
||||||
"regex(/^\\d+$/)"
|
"regex(/^\\d+$/)"
|
||||||
);
|
);
|
||||||
@@ -1355,7 +1355,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_regex",
|
"checkRealTypeRegex",
|
||||||
"235",
|
"235",
|
||||||
"regex(/^\\d{3}$/)"
|
"regex(/^\\d{3}$/)"
|
||||||
);
|
);
|
||||||
@@ -1366,7 +1366,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_regex",
|
"checkRealTypeRegex",
|
||||||
"235",
|
"235",
|
||||||
"regex(/^\\d{4}$/)"
|
"regex(/^\\d{4}$/)"
|
||||||
);
|
);
|
||||||
@@ -1377,7 +1377,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_regex",
|
"checkRealTypeRegex",
|
||||||
"abcdef",
|
"abcdef",
|
||||||
"regex(/^[a-z]+$/)"
|
"regex(/^[a-z]+$/)"
|
||||||
);
|
);
|
||||||
@@ -1388,7 +1388,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_regex",
|
"checkRealTypeRegex",
|
||||||
"Abcdef",
|
"Abcdef",
|
||||||
"regex(/^[a-z]+$/)"
|
"regex(/^[a-z]+$/)"
|
||||||
);
|
);
|
||||||
@@ -1400,7 +1400,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_mail",
|
"checkRealTypeMail",
|
||||||
"toto@example.com",
|
"toto@example.com",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1411,7 +1411,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_mail",
|
"checkRealTypeMail",
|
||||||
"toto@",
|
"toto@",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1423,7 +1423,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_uuid",
|
"checkRealTypeUuid",
|
||||||
"4e799e3f-f376-46e5-a5db-85200949987e",
|
"4e799e3f-f376-46e5-a5db-85200949987e",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1434,7 +1434,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_uuid",
|
"checkRealTypeUuid",
|
||||||
"4E799E3F-F376-46E5-A5DB-85200949987E",
|
"4E799E3F-F376-46E5-A5DB-85200949987E",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1445,7 +1445,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_uuid",
|
"checkRealTypeUuid",
|
||||||
"4E799E3F-F376-46E5+A5DB+85200949987E",
|
"4E799E3F-F376-46E5+A5DB+85200949987E",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1456,7 +1456,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_uuid",
|
"checkRealTypeUuid",
|
||||||
"4E799E3F5F376546E55A5DB585200949987E",
|
"4E799E3F5F376546E55A5DB585200949987E",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1468,7 +1468,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqldate",
|
"checkRealTypeSqldate",
|
||||||
"2018-10-24",
|
"2018-10-24",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1479,7 +1479,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqldate",
|
"checkRealTypeSqldate",
|
||||||
"2018/10/24",
|
"2018/10/24",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1490,7 +1490,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqldate",
|
"checkRealTypeSqldate",
|
||||||
"2018-10-32",
|
"2018-10-32",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1502,7 +1502,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqltime",
|
"checkRealTypeSqltime",
|
||||||
"12:34:56",
|
"12:34:56",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1513,7 +1513,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqltime",
|
"checkRealTypeSqltime",
|
||||||
"12;22;22",
|
"12;22;22",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1524,7 +1524,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqltime",
|
"checkRealTypeSqltime",
|
||||||
"32:34:56",
|
"32:34:56",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1536,7 +1536,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqldatetime",
|
"checkRealTypeSqldatetime",
|
||||||
"2018-10-24 22:23:24",
|
"2018-10-24 22:23:24",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1547,7 +1547,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqldatetime",
|
"checkRealTypeSqldatetime",
|
||||||
"2018/10/24",
|
"2018/10/24",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
@@ -1558,7 +1558,7 @@ class DblayerooTest{ENGINE} extends \PHPUnit_Framework_TestCase
|
|||||||
$tbl1 = $this->tbl1();
|
$tbl1 = $this->tbl1();
|
||||||
$res = $this->invokeMethod(
|
$res = $this->invokeMethod(
|
||||||
$tbl1,
|
$tbl1,
|
||||||
"checkRealType_sqldatetime",
|
"checkRealTypeSqldatetime",
|
||||||
"2018-10-24 25:12:25",
|
"2018-10-24 25:12:25",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ define("PHPUNIT", "ON-GOING");
|
|||||||
file_put_contents(
|
file_put_contents(
|
||||||
"Tests/DblayerooSqliteTest.php",
|
"Tests/DblayerooSqliteTest.php",
|
||||||
str_replace(
|
str_replace(
|
||||||
"{ENGINE}",
|
"ENGINE",
|
||||||
"sqlite",
|
"sqlite",
|
||||||
file_get_contents("Tests/DblayerooComplet.php")
|
file_get_contents("Tests/DblayerooComplet.php")
|
||||||
)
|
)
|
||||||
@@ -33,7 +33,7 @@ file_put_contents(
|
|||||||
file_put_contents(
|
file_put_contents(
|
||||||
"Tests/DblayerooMySQLTest.php",
|
"Tests/DblayerooMySQLTest.php",
|
||||||
str_replace(
|
str_replace(
|
||||||
"{ENGINE}",
|
"ENGINE",
|
||||||
"mysql",
|
"mysql",
|
||||||
file_get_contents("Tests/DblayerooComplet.php")
|
file_get_contents("Tests/DblayerooComplet.php")
|
||||||
)
|
)
|
||||||
@@ -41,7 +41,7 @@ file_put_contents(
|
|||||||
file_put_contents(
|
file_put_contents(
|
||||||
"Tests/DblayerooPostgreSQLTest.php",
|
"Tests/DblayerooPostgreSQLTest.php",
|
||||||
str_replace(
|
str_replace(
|
||||||
"{ENGINE}",
|
"ENGINE",
|
||||||
"pgsql",
|
"pgsql",
|
||||||
file_get_contents("Tests/DblayerooComplet.php")
|
file_get_contents("Tests/DblayerooComplet.php")
|
||||||
)
|
)
|
||||||
@@ -49,7 +49,7 @@ file_put_contents(
|
|||||||
file_put_contents(
|
file_put_contents(
|
||||||
"Tests/DblayerSqliteTest.php",
|
"Tests/DblayerSqliteTest.php",
|
||||||
str_replace(
|
str_replace(
|
||||||
"{ENGINE}",
|
"ENGINE",
|
||||||
"sqlite",
|
"sqlite",
|
||||||
file_get_contents("Tests/DblayerComplet.php")
|
file_get_contents("Tests/DblayerComplet.php")
|
||||||
)
|
)
|
||||||
@@ -57,7 +57,7 @@ file_put_contents(
|
|||||||
file_put_contents(
|
file_put_contents(
|
||||||
"Tests/DblayerMySQLTest.php",
|
"Tests/DblayerMySQLTest.php",
|
||||||
str_replace(
|
str_replace(
|
||||||
"{ENGINE}",
|
"ENGINE",
|
||||||
"mysql",
|
"mysql",
|
||||||
file_get_contents("Tests/DblayerComplet.php")
|
file_get_contents("Tests/DblayerComplet.php")
|
||||||
)
|
)
|
||||||
@@ -65,7 +65,7 @@ file_put_contents(
|
|||||||
file_put_contents(
|
file_put_contents(
|
||||||
"Tests/DblayerPostgreSQLTest.php",
|
"Tests/DblayerPostgreSQLTest.php",
|
||||||
str_replace(
|
str_replace(
|
||||||
"{ENGINE}",
|
"ENGINE",
|
||||||
"pgsql",
|
"pgsql",
|
||||||
file_get_contents("Tests/DblayerComplet.php")
|
file_get_contents("Tests/DblayerComplet.php")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ class Authldap extends Auth
|
|||||||
"email" => $vals["mail"][0]];
|
"email" => $vals["mail"][0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data[$key]["mail"]["count"]);
|
unset($data[$key]["email"]["count"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
@@ -490,10 +490,10 @@ class Authorizationdb extends Authorization
|
|||||||
* Change mode bits for an object
|
* Change mode bits for an object
|
||||||
* Need to be the owner of the object or the root administrator
|
* Need to be the owner of the object or the root administrator
|
||||||
* @param string $object Object path to change
|
* @param string $object Object path to change
|
||||||
* @param integer $mod Bits of authorization
|
* @param integer $modbits Bits of authorization
|
||||||
* @return boolean TRUE or an exception with the error message
|
* @return boolean TRUE or an exception with the error message
|
||||||
*/
|
*/
|
||||||
public function chmod($object, $mod)
|
public function chmod($object, $modbits)
|
||||||
{
|
{
|
||||||
if ($this->db === null) {
|
if ($this->db === null) {
|
||||||
throw new \Exception(dgettext(
|
throw new \Exception(dgettext(
|
||||||
@@ -743,6 +743,7 @@ class Authorizationdb extends Authorization
|
|||||||
|
|
||||||
foreach ($parents as $i => $p) {
|
foreach ($parents as $i => $p) {
|
||||||
$found = false;
|
$found = false;
|
||||||
|
$r = [];
|
||||||
foreach ($res as $r) {
|
foreach ($res as $r) {
|
||||||
if ($r["object"] === $p) {
|
if ($r["object"] === $p) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Authshibboleth extends Auth
|
|||||||
/**
|
/**
|
||||||
* The optional URL to change the user password
|
* The optional URL to change the user password
|
||||||
*/
|
*/
|
||||||
public $urlPasswd = "";
|
public $urlPasswdChange = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No connection to shibboleth
|
* No connection to shibboleth
|
||||||
|
|||||||
19
src/Cli.php
19
src/Cli.php
@@ -91,6 +91,7 @@ class Cli
|
|||||||
// This error code is not included in error_reporting
|
// This error code is not included in error_reporting
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$severity = "ERROR";
|
||||||
switch ($errno) {
|
switch ($errno) {
|
||||||
case E_ERROR:
|
case E_ERROR:
|
||||||
$severity = "ERROR";
|
$severity = "ERROR";
|
||||||
@@ -217,6 +218,7 @@ class Cli
|
|||||||
}
|
}
|
||||||
die("No controllers/models available in " . getcwd() . "\n");
|
die("No controllers/models available in " . getcwd() . "\n");
|
||||||
}
|
}
|
||||||
|
$classes = [];
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (strpos($file, "_")) {
|
if (strpos($file, "_")) {
|
||||||
$classes[substr(strstr($file, "_"), 1, -4)] = $file;
|
$classes[substr(strstr($file, "_"), 1, -4)] = $file;
|
||||||
@@ -415,16 +417,21 @@ class Cli
|
|||||||
|
|
||||||
if (in_array("-?", $argv, true)) {
|
if (in_array("-?", $argv, true)) {
|
||||||
// Question mark display the PHPDoc of the method
|
// Question mark display the PHPDoc of the method
|
||||||
$comment = trim(substr($r1->getDocComment(), 3, -2));
|
$comment = "";
|
||||||
if ($comment !== "") {
|
if (isset($r1)) {
|
||||||
$comment .= "\n";
|
$comment = trim(substr($r1->getDocComment(), 3, -2));
|
||||||
|
if ($comment !== "") {
|
||||||
|
$comment .= "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$comment .= trim(substr($r2->getDocComment(), 3, -2));
|
$comment .= trim(substr($r2->getDocComment(), 3, -2));
|
||||||
$comment = preg_replace("#^\s*\*\s*#m", "", $comment);
|
$comment = preg_replace("#^\s*\*\s*#m", "", $comment);
|
||||||
$comment = preg_replace("#@param .+ \\$(\w+) #U", "<\\1> ", $comment);
|
$comment = preg_replace("#@param .+ \\$(\w+) #U", "<\\1> ", $comment);
|
||||||
$params = "";
|
$params = "";
|
||||||
foreach ($r1->getParameters() as $param) {
|
if (isset($r1)) {
|
||||||
$params .= "<" . $param->name . "> ";
|
foreach ($r1->getParameters() as $param) {
|
||||||
|
$params .= "<" . $param->name . "> ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach ($r2->getParameters() as $param) {
|
foreach ($r2->getParameters() as $param) {
|
||||||
$params .= "<" . $param->name . "> ";
|
$params .= "<" . $param->name . "> ";
|
||||||
@@ -449,7 +456,7 @@ class Cli
|
|||||||
// (Array management in CLI)
|
// (Array management in CLI)
|
||||||
foreach ($argv as $key => $arg) {
|
foreach ($argv as $key => $arg) {
|
||||||
// Don't modify the stdin
|
// Don't modify the stdin
|
||||||
if (isset($keyStdIn) && $key === $keyStdIn) {
|
if ($key === $keyStdIn) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$pairs = explode('&', $arg);
|
$pairs = explode('&', $arg);
|
||||||
|
|||||||
@@ -694,7 +694,7 @@ class Console
|
|||||||
*/
|
*/
|
||||||
public function completeFunction($completionKeys, $completionFunction)
|
public function completeFunction($completionKeys, $completionFunction)
|
||||||
{
|
{
|
||||||
if (! is_string($completionKeys) && ! is_boolean($completionKeys)) {
|
if (! is_string($completionKeys) && ! is_bool($completionKeys)) {
|
||||||
$this->consoleException("Can not set the completionKeys : not a string");
|
$this->consoleException("Can not set the completionKeys : not a string");
|
||||||
}
|
}
|
||||||
if ($completionKeys === true) {
|
if ($completionKeys === true) {
|
||||||
|
|||||||
@@ -351,12 +351,12 @@ class Dblayeroo
|
|||||||
if ($this->sep === "") {
|
if ($this->sep === "") {
|
||||||
$this->DBException(dgettext("domframework", "Database not connected"));
|
$this->DBException(dgettext("domframework", "Database not connected"));
|
||||||
}
|
}
|
||||||
|
$res = [];
|
||||||
switch (self::$instance[$this->dsn]->getAttribute(\PDO::ATTR_DRIVER_NAME)) {
|
switch (self::$instance[$this->dsn]->getAttribute(\PDO::ATTR_DRIVER_NAME)) {
|
||||||
case "sqlite":
|
case "sqlite":
|
||||||
$req = "SELECT name FROM sqlite_master WHERE type='table'";
|
$req = "SELECT name FROM sqlite_master WHERE type='table'";
|
||||||
$st = self::$instance[$this->dsn]->prepare($req);
|
$st = self::$instance[$this->dsn]->prepare($req);
|
||||||
$st->execute();
|
$st->execute();
|
||||||
$res = [];
|
|
||||||
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
|
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
|
||||||
if ($d["name"] !== "sqlite_sequence") {
|
if ($d["name"] !== "sqlite_sequence") {
|
||||||
$res[] = $d["name"];
|
$res[] = $d["name"];
|
||||||
@@ -369,7 +369,6 @@ class Dblayeroo
|
|||||||
WHERE TABLE_SCHEMA='" . $this->databasename() . "'";
|
WHERE TABLE_SCHEMA='" . $this->databasename() . "'";
|
||||||
$st = self::$instance[$this->dsn]->prepare($req);
|
$st = self::$instance[$this->dsn]->prepare($req);
|
||||||
$st->execute();
|
$st->execute();
|
||||||
$res = [];
|
|
||||||
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
|
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
|
||||||
$res[] = $d["TABLE_NAME"];
|
$res[] = $d["TABLE_NAME"];
|
||||||
}
|
}
|
||||||
@@ -380,7 +379,6 @@ class Dblayeroo
|
|||||||
WHERE schemaname = 'public'";
|
WHERE schemaname = 'public'";
|
||||||
$st = self::$instance[$this->dsn]->prepare($req);
|
$st = self::$instance[$this->dsn]->prepare($req);
|
||||||
$st->execute();
|
$st->execute();
|
||||||
$res = [];
|
|
||||||
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
|
while ($d = $st->fetch(\PDO::FETCH_ASSOC)) {
|
||||||
$res[] = $d["tablename"];
|
$res[] = $d["tablename"];
|
||||||
}
|
}
|
||||||
@@ -430,6 +428,7 @@ class Dblayeroo
|
|||||||
"No table name defined to create the table"
|
"No table name defined to create the table"
|
||||||
), 500);
|
), 500);
|
||||||
}
|
}
|
||||||
|
$sql = "";
|
||||||
switch (self::$instance[$this->dsn]->getAttribute(\PDO::ATTR_DRIVER_NAME)) {
|
switch (self::$instance[$this->dsn]->getAttribute(\PDO::ATTR_DRIVER_NAME)) {
|
||||||
case "sqlite":
|
case "sqlite":
|
||||||
$sql = "CREATE TABLE IF NOT EXISTS " .
|
$sql = "CREATE TABLE IF NOT EXISTS " .
|
||||||
@@ -1684,7 +1683,7 @@ class Dblayeroo
|
|||||||
}
|
}
|
||||||
@list($func, $param) = explode("(", $realType);
|
@list($func, $param) = explode("(", $realType);
|
||||||
$func = trim($func);
|
$func = trim($func);
|
||||||
$method = "checkRealType_" . $func;
|
$method = "checkRealType" . ucfirst($func);
|
||||||
if (! method_exists($this, $method)) {
|
if (! method_exists($this, $method)) {
|
||||||
$this->DBException("Invalid setRealType provided : " .
|
$this->DBException("Invalid setRealType provided : " .
|
||||||
"field '$field' : unknown realType provided '$func'");
|
"field '$field' : unknown realType provided '$func'");
|
||||||
@@ -2008,10 +2007,10 @@ class Dblayeroo
|
|||||||
}
|
}
|
||||||
$display = $name = trim($display);
|
$display = $name = trim($display);
|
||||||
$pos = strpos($display, "(");
|
$pos = strpos($display, "(");
|
||||||
|
$separator = "";
|
||||||
if ($pos !== false) {
|
if ($pos !== false) {
|
||||||
$func = strtoupper(trim(substr($name, 0, $pos)));
|
$func = strtoupper(trim(substr($name, 0, $pos)));
|
||||||
$name = trim(substr($name, $pos + 1, -1));
|
$name = trim(substr($name, $pos + 1, -1));
|
||||||
$separator = "";
|
|
||||||
if (
|
if (
|
||||||
in_array($func, ["AVG", "COUNT", "GROUP_CONCAT", "MAX",
|
in_array($func, ["AVG", "COUNT", "GROUP_CONCAT", "MAX",
|
||||||
"MIN","SUM"], true)
|
"MIN","SUM"], true)
|
||||||
@@ -2848,6 +2847,7 @@ class Dblayeroo
|
|||||||
"The unique configuration is not an array"
|
"The unique configuration is not an array"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
$sql = "";
|
||||||
switch ($this->command) {
|
switch ($this->command) {
|
||||||
case "SELECT":
|
case "SELECT":
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
@@ -2980,7 +2980,7 @@ class Dblayeroo
|
|||||||
try {
|
try {
|
||||||
$st = self::$instance[$this->dsn]->prepare($sql);
|
$st = self::$instance[$this->dsn]->prepare($sql);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->DBException($e->getMessage());
|
throw $this->DBException($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($this->whereGetValues() as $hash => $val) {
|
foreach ($this->whereGetValues() as $hash => $val) {
|
||||||
@@ -3053,7 +3053,7 @@ class Dblayeroo
|
|||||||
$text .= "(date)\n";
|
$text .= "(date)\n";
|
||||||
} else {
|
} else {
|
||||||
$text .= "(UNKNOWN)\n";
|
$text .= "(UNKNOWN)\n";
|
||||||
$this->DBException("TO BE DEVELOPPED : " . $fields[$field][0]);
|
$this->DBException("TO BE DEVELOPPED : Unknown type : " . $type);
|
||||||
}
|
}
|
||||||
if (!$textForm) {
|
if (!$textForm) {
|
||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
@@ -3306,6 +3306,7 @@ class Dblayeroo
|
|||||||
}
|
}
|
||||||
$setValues = $values;
|
$setValues = $values;
|
||||||
$foundImpactedLines = 0;
|
$foundImpactedLines = 0;
|
||||||
|
$resUpdate = [];
|
||||||
foreach ($uniques as $k => $columns) {
|
foreach ($uniques as $k => $columns) {
|
||||||
if ($update) {
|
if ($update) {
|
||||||
// Can not update multiple UNIQUE rows with the same value
|
// Can not update multiple UNIQUE rows with the same value
|
||||||
@@ -3314,7 +3315,7 @@ class Dblayeroo
|
|||||||
} elseif (is_array($columns)) {
|
} elseif (is_array($columns)) {
|
||||||
$cols = $columns;
|
$cols = $columns;
|
||||||
} else {
|
} else {
|
||||||
$this->DBException(dgettext(
|
throw $this->DBException(dgettext(
|
||||||
"domframework",
|
"domframework",
|
||||||
"Unique def is not a string or an array"
|
"Unique def is not a string or an array"
|
||||||
));
|
));
|
||||||
@@ -3592,7 +3593,7 @@ class Dblayeroo
|
|||||||
$val = trim($values[$field]);
|
$val = trim($values[$field]);
|
||||||
@list($func, $param) = explode("(", $this->realTypes[$field]);
|
@list($func, $param) = explode("(", $this->realTypes[$field]);
|
||||||
$func = trim($func);
|
$func = trim($func);
|
||||||
$method = "checkRealType_" . $func;
|
$method = "checkRealType" . ucfirst($func);
|
||||||
$res = $this->$method($val, $this->realTypes[$field]);
|
$res = $this->$method($val, $this->realTypes[$field]);
|
||||||
if (is_string($res)) {
|
if (is_string($res)) {
|
||||||
$errors[$field] = $res;
|
$errors[$field] = $res;
|
||||||
@@ -3796,7 +3797,7 @@ class Dblayeroo
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($autoInc !== null) {
|
if ($autoInc !== null && isset($col)) {
|
||||||
$autoInc = $this->table . "_{$col}_seq";
|
$autoInc = $this->table . "_{$col}_seq";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3912,7 +3913,7 @@ class Dblayeroo
|
|||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string or null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_integerPositive($val, $definition)
|
private function checkRealTypeIntegerPositive($val, $definition)
|
||||||
{
|
{
|
||||||
if (substr($val, 0, 1) === "-") {
|
if (substr($val, 0, 1) === "-") {
|
||||||
return dgettext("domframework", "Invalid positive integer : " .
|
return dgettext("domframework", "Invalid positive integer : " .
|
||||||
@@ -3935,7 +3936,7 @@ class Dblayeroo
|
|||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string or null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_integer($val, $definition)
|
private function checkRealTypeInteger($val, $definition)
|
||||||
{
|
{
|
||||||
if (strspn($val, "0123456789-") !== strlen($val)) {
|
if (strspn($val, "0123456789-") !== strlen($val)) {
|
||||||
return dgettext("domframework", "Invalid integer : " .
|
return dgettext("domframework", "Invalid integer : " .
|
||||||
@@ -3959,7 +3960,7 @@ class Dblayeroo
|
|||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string or null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_allowedchars($val, $definition)
|
private function checkRealTypeAllowedchars($val, $definition)
|
||||||
{
|
{
|
||||||
list($func, $param) = explode("(", $definition);
|
list($func, $param) = explode("(", $definition);
|
||||||
if ($param === null) {
|
if ($param === null) {
|
||||||
@@ -3988,7 +3989,7 @@ class Dblayeroo
|
|||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string or null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_array($val, $definition)
|
private function checkRealTypeArray($val, $definition)
|
||||||
{
|
{
|
||||||
list($func, $param) = explode("(", $definition);
|
list($func, $param) = explode("(", $definition);
|
||||||
if ($param === null) {
|
if ($param === null) {
|
||||||
@@ -4018,7 +4019,7 @@ class Dblayeroo
|
|||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string or null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_regex($val, $definition)
|
private function checkRealTypeRegex($val, $definition)
|
||||||
{
|
{
|
||||||
list($func, $param) = explode("(", $definition);
|
list($func, $param) = explode("(", $definition);
|
||||||
if ($param === null) {
|
if ($param === null) {
|
||||||
@@ -4047,7 +4048,7 @@ class Dblayeroo
|
|||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string or null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_mail($val, $definition)
|
private function checkRealTypeMail($val, $definition)
|
||||||
{
|
{
|
||||||
if (!! filter_var($val, FILTER_VALIDATE_EMAIL)) {
|
if (!! filter_var($val, FILTER_VALIDATE_EMAIL)) {
|
||||||
return;
|
return;
|
||||||
@@ -4059,9 +4060,9 @@ class Dblayeroo
|
|||||||
* Check the type "uuid"
|
* Check the type "uuid"
|
||||||
* @param string $val The value to check
|
* @param string $val The value to check
|
||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_uuid($val, $definition)
|
private function checkRealTypeUuid($val, $definition)
|
||||||
{
|
{
|
||||||
if (strlen($val) !== 36) {
|
if (strlen($val) !== 36) {
|
||||||
return dgettext("domframework", "Invalid UUID provided : " .
|
return dgettext("domframework", "Invalid UUID provided : " .
|
||||||
@@ -4082,9 +4083,9 @@ class Dblayeroo
|
|||||||
* Check the type "sqldate"
|
* Check the type "sqldate"
|
||||||
* @param string $val The value to check
|
* @param string $val The value to check
|
||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_sqldate($val, $definition)
|
private function checkRealTypeSqldate($val, $definition)
|
||||||
{
|
{
|
||||||
if (strlen($val) !== 10) {
|
if (strlen($val) !== 10) {
|
||||||
return dgettext("domframework", "Invalid date provided : " .
|
return dgettext("domframework", "Invalid date provided : " .
|
||||||
@@ -4117,9 +4118,9 @@ class Dblayeroo
|
|||||||
* Check the type "sqltime"
|
* Check the type "sqltime"
|
||||||
* @param string $val The value to check
|
* @param string $val The value to check
|
||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_sqltime($val, $definition)
|
private function checkRealTypeSqltime($val, $definition)
|
||||||
{
|
{
|
||||||
if (strlen($val) !== 8) {
|
if (strlen($val) !== 8) {
|
||||||
return dgettext("domframework", "Invalid time provided : " .
|
return dgettext("domframework", "Invalid time provided : " .
|
||||||
@@ -4152,9 +4153,9 @@ class Dblayeroo
|
|||||||
* Check the type "sqldatetime"
|
* Check the type "sqldatetime"
|
||||||
* @param string $val The value to check
|
* @param string $val The value to check
|
||||||
* @param string $definition The definition of the type
|
* @param string $definition The definition of the type
|
||||||
* @return string or null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
private function checkRealType_sqldatetime($val, $definition)
|
private function checkRealTypeSqldatetime($val, $definition)
|
||||||
{
|
{
|
||||||
if (strlen($val) !== 19) {
|
if (strlen($val) !== 19) {
|
||||||
return dgettext("domframework", "Invalid date and time provided : " .
|
return dgettext("domframework", "Invalid date and time provided : " .
|
||||||
|
|||||||
@@ -691,6 +691,7 @@ class File
|
|||||||
$newname = $this->realpath($newname);
|
$newname = $this->realpath($newname);
|
||||||
$this->checkPathRO(dirname($oldname));
|
$this->checkPathRO(dirname($oldname));
|
||||||
$this->checkPathRW(dirname($newname));
|
$this->checkPathRW(dirname($newname));
|
||||||
|
$rc = "";
|
||||||
if (is_dir($oldname)) {
|
if (is_dir($oldname)) {
|
||||||
// Copy directory structure
|
// Copy directory structure
|
||||||
if (! $this->file_exists($newname)) {
|
if (! $this->file_exists($newname)) {
|
||||||
|
|||||||
@@ -471,7 +471,8 @@ class Form
|
|||||||
public function getToken()
|
public function getToken()
|
||||||
{
|
{
|
||||||
if ($this->csrfToken === "") {
|
if ($this->csrfToken === "") {
|
||||||
$this->createToken();
|
$csrf = new Csrf();
|
||||||
|
$this->csrfToken = $csrf->newToken();
|
||||||
}
|
}
|
||||||
return $this->csrfToken;
|
return $this->csrfToken;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ class Formfield
|
|||||||
* The Bootstrap width of the column of fields
|
* The Bootstrap width of the column of fields
|
||||||
*/
|
*/
|
||||||
public $fieldwidth = 10;
|
public $fieldwidth = 10;
|
||||||
|
/**
|
||||||
|
* Form template (Bootstrap3 by default)
|
||||||
|
*/
|
||||||
|
private $formTemplate = "Bootstrap3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When adding a field, the name and the label are the minimum mandatory
|
* When adding a field, the name and the label are the minimum mandatory
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ class Graph
|
|||||||
*/
|
*/
|
||||||
public $title = null;
|
public $title = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The graph title position
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $titlePosition = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The height of the graph (150px by default)
|
* The height of the graph (150px by default)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ class GraphAxisHorizontal extends GraphAxisGeneral
|
|||||||
*/
|
*/
|
||||||
public function positionMin($value)
|
public function positionMin($value)
|
||||||
{
|
{
|
||||||
|
$posCenter = $this->position($value);
|
||||||
if ($this->numerical) {
|
if ($this->numerical) {
|
||||||
return $posCenter;
|
return $posCenter;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ class GraphAxisVertical extends GraphAxisGeneral
|
|||||||
*/
|
*/
|
||||||
public function positionMin($value)
|
public function positionMin($value)
|
||||||
{
|
{
|
||||||
|
$posCenter = $this->position($value);
|
||||||
if ($this->numerical) {
|
if ($this->numerical) {
|
||||||
return $posCenter;
|
return $posCenter;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ class GraphSerie
|
|||||||
"Invalid style provided to serie"
|
"Invalid style provided to serie"
|
||||||
), 406);
|
), 406);
|
||||||
}
|
}
|
||||||
$styleClass = "GraphStyle" . $style;
|
$styleClass = "GraphStyle" . ucfirst($style);
|
||||||
if ($this->style === null) {
|
if ($this->style === null) {
|
||||||
$this->style = new $styleClass();
|
$this->style = new $styleClass();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user