Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
|
||||
/** DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
/**
|
||||
* DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
@@ -13,23 +14,23 @@ use Domframework\Authzgroups;
|
||||
|
||||
class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public $confs = array (
|
||||
"sqlite" => array (
|
||||
public $confs = [
|
||||
"sqlite" => [
|
||||
"dsn" => "sqlite:/tmp/databaseAuthz.db",
|
||||
"username" => null,
|
||||
"password" => null,
|
||||
"driver_options" => null,
|
||||
"tableprefix" => "",
|
||||
));
|
||||
]];
|
||||
|
||||
public function test_delDB()
|
||||
public function testDelDB()
|
||||
{
|
||||
if (file_exists("/tmp/databaseAuthz.db")) {
|
||||
unlink("/tmp/databaseAuthz.db");
|
||||
}
|
||||
}
|
||||
|
||||
public function test_createTablesAuthzgroups()
|
||||
public function testCreateTablesAuthzgroups()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -50,11 +51,11 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$a->rightAdd("modTest", "group", "/article", "RO");
|
||||
$a->rightAdd("modTest", "group", "/article/base", "RO");
|
||||
$res = $a->rightAdd("modTest", "group", "/article/base/poub", "RW");
|
||||
// Should not be verified : it is not a test for authzgroups !
|
||||
// Should not be verified : it is not a test for authzgroups !
|
||||
$this->assertSame("4", $res);
|
||||
}
|
||||
|
||||
public function test_createTable()
|
||||
public function testCreateTable()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$n = new Dblayerauthzgroups(
|
||||
@@ -71,21 +72,21 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")));
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]]);
|
||||
$res = $n->createTable();
|
||||
$this->assertSame(0, $res);
|
||||
}
|
||||
|
||||
public function test_insert1()
|
||||
public function testInsert1()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -102,29 +103,29 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
->createGroupSet("group")
|
||||
->pathSet("/article/base/poub");
|
||||
$res = $n->insert(array ("zo ne" => "zone1",
|
||||
"opendate" => "2015-05-04 00:11:22"));
|
||||
$res = $n->insert(["zo ne" => "zone1",
|
||||
"opendate" => "2015-05-04 00:11:22"]);
|
||||
$n->disconnect();
|
||||
$this->assertSame("1", $res);
|
||||
}
|
||||
|
||||
// Check if the update of the authzgroups database is OK
|
||||
public function test_addAuthzgroups()
|
||||
public function testAddAuthzgroups()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -138,7 +139,7 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertSame("RW", $res);
|
||||
}
|
||||
|
||||
public function test_insert2()
|
||||
public function testInsert2()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -155,32 +156,32 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
->createGroupSet("group")
|
||||
->pathSet("/article/base/poub");
|
||||
$n->insert(array ("zo ne" => "zone2", "opendate" => "2015-05-04 00:11:22"));
|
||||
$n->insert(array ("zo ne" => "zone3", "opendate" => "2015-05-04 00:11:22"));
|
||||
$n->insert(array ("zo ne" => "zone4", "opendate" => "2015-05-04 00:11:22"));
|
||||
$res = $n->insert(array ("zo ne" => "zone5",
|
||||
"opendate" => "2015-05-04 00:11:22"));
|
||||
$n->insert(["zo ne" => "zone2", "opendate" => "2015-05-04 00:11:22"]);
|
||||
$n->insert(["zo ne" => "zone3", "opendate" => "2015-05-04 00:11:22"]);
|
||||
$n->insert(["zo ne" => "zone4", "opendate" => "2015-05-04 00:11:22"]);
|
||||
$res = $n->insert(["zo ne" => "zone5",
|
||||
"opendate" => "2015-05-04 00:11:22"]);
|
||||
$n->disconnect();
|
||||
$this->assertSame("5", $res);
|
||||
}
|
||||
|
||||
// Access to all the tuples
|
||||
public function test_read1()
|
||||
public function testRead1()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -197,16 +198,16 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
@@ -218,7 +219,7 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Remove the right access to 2 and 4
|
||||
public function test_rightDel()
|
||||
public function testRightDel()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -230,12 +231,12 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
$a->rightDel("modTest", "group", "/article/base/poub/2");
|
||||
$res = $a->rightDel("modTest", "group", "/article/base/poub/4");
|
||||
// Should not be verified : it is not a test for authzgroups !
|
||||
// Should not be verified : it is not a test for authzgroups !
|
||||
$this->assertSame(1, $res);
|
||||
}
|
||||
|
||||
// Access to 3 of the tuples (2 are blacklisted for the user)
|
||||
public function test_read2()
|
||||
public function testRead2()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -252,16 +253,16 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
@@ -273,7 +274,7 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Del an entry without right -> exception
|
||||
public function test_delEntry1()
|
||||
public function testDelEntry1()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -290,16 +291,16 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
@@ -310,7 +311,7 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Update a right to RO
|
||||
public function test_rightRO()
|
||||
public function testRightRO()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -321,12 +322,12 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$res = $a->rightUpdate("modTest", "group", "/article/base/poub/1", "RO");
|
||||
// Not necessary to test : authzgroups
|
||||
// Not necessary to test : authzgroups
|
||||
$this->assertSame(1, $res);
|
||||
}
|
||||
|
||||
// Update an entry with RO right -> exception
|
||||
public function test_updateEntry2()
|
||||
public function testUpdateEntry2()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -343,27 +344,27 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
->createGroupSet("group")
|
||||
->pathSet("/article/base/poub");
|
||||
$this->setExpectedException("Exception");
|
||||
$res = $n->update(1, array ("zo ne" => "NOT ALLOWED"));
|
||||
$res = $n->update(1, ["zo ne" => "NOT ALLOWED"]);
|
||||
}
|
||||
|
||||
// Del an entry with the RO right -> exception
|
||||
public function test_delEntry2()
|
||||
public function testDelEntry2()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -380,16 +381,16 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
@@ -400,7 +401,7 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Update a right to RW
|
||||
public function test_rightRW()
|
||||
public function testRightRW()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -411,12 +412,12 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$res = $a->rightUpdate("modTest", "group", "/article/base/poub/1", "RW");
|
||||
// Not necessary to test : authzgroups
|
||||
// Not necessary to test : authzgroups
|
||||
$this->assertSame(1, $res);
|
||||
}
|
||||
|
||||
// Update an entry with RW right
|
||||
public function test_updateEntry3()
|
||||
public function testUpdateEntry3()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -433,27 +434,27 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
->createGroupSet("group")
|
||||
->pathSet("/article/base/poub");
|
||||
$res = $n->update(1, array ("zo ne" => "ALLOWED"));
|
||||
$res = $n->update(1, ["zo ne" => "ALLOWED"]);
|
||||
$this->assertSame(1, $res);
|
||||
}
|
||||
|
||||
// Del an entry with the RW right
|
||||
public function test_delEntry3()
|
||||
public function testDelEntry3()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -470,16 +471,16 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
@@ -490,7 +491,7 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
// Check if the update of the authzgroups database is OK after deletion
|
||||
public function test_delAuthzgroups()
|
||||
public function testDelAuthzgroups()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -501,12 +502,12 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$res = $a->objectRead("modTest", "/article/base/poub/1");
|
||||
$this->assertSame(array (), $res);
|
||||
$this->assertSame([], $res);
|
||||
}
|
||||
|
||||
|
||||
// Read the zone without id
|
||||
public function test_read3()
|
||||
public function testRead3()
|
||||
{
|
||||
$dbconfig = $this->confs["sqlite"];
|
||||
$a = new Authzgroups();
|
||||
@@ -523,25 +524,25 @@ class DblayerauthzgroupsTest extends \PHPUnit_Framework_TestCase
|
||||
$dbconfig["driver_options"]
|
||||
);
|
||||
$n->tableSet("dns zones")
|
||||
->fieldsSet(array (
|
||||
"id" => array ("integer", "not null", "autoincrement"),
|
||||
"zo ne" => array ("varchar", "255", "not null"),
|
||||
"vie wname" => array ("varchar", "255"),
|
||||
"view clients" => array ("varchar", "255"),
|
||||
"comme nt" => array ("varchar", "1024"),
|
||||
"opendate" => array ("datetime", "not null"),
|
||||
"closedate" => array ("datetime")))
|
||||
->fieldsSet([
|
||||
"id" => ["integer", "not null", "autoincrement"],
|
||||
"zo ne" => ["varchar", "255", "not null"],
|
||||
"vie wname" => ["varchar", "255"],
|
||||
"view clients" => ["varchar", "255"],
|
||||
"comme nt" => ["varchar", "1024"],
|
||||
"opendate" => ["datetime", "not null"],
|
||||
"closedate" => ["datetime"]])
|
||||
->primarySet("id")
|
||||
->uniqueSet(array ("id", array ("zo ne", "vie wname")))
|
||||
->uniqueSet(["id", ["zo ne", "vie wname"]])
|
||||
->authzgroupsSet($a)
|
||||
->moduleSet("modTest")
|
||||
->userSet("user")
|
||||
->createGroupSet("group")
|
||||
->pathSet("/article/base/poub");
|
||||
$res = $n->read(null, array ("zo ne", "vie wname"));
|
||||
$res = $n->read(null, ["zo ne", "vie wname"]);
|
||||
$this->assertSame(
|
||||
array (1 => array ("zo ne" => "zone3", "vie wname" => null),
|
||||
3 => array ("zo ne" => "zone5", "vie wname" => null)),
|
||||
[1 => ["zo ne" => "zone3", "vie wname" => null],
|
||||
3 => ["zo ne" => "zone5", "vie wname" => null]],
|
||||
$res
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user