Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
<?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;
|
||||
|
||||
use Domframework\Authzgroupsoo;
|
||||
|
||||
/** Test the Authzgroupsoo.php file */
|
||||
/**
|
||||
* Test the Authzgroupsoo.php file
|
||||
*/
|
||||
class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $dbconfig = array (
|
||||
private $dbconfig = [
|
||||
"dsn" => "sqlite:/tmp/databaseAuthzGroupsoo.db",
|
||||
"username" => null,
|
||||
"password" => null,
|
||||
"driver_options" => null,
|
||||
"tableprefix" => "",
|
||||
);
|
||||
];
|
||||
public function testInitialization()
|
||||
{
|
||||
if (file_exists("/tmp/databaseAuthzGroupsoo.db")) {
|
||||
@@ -36,8 +39,8 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testConnect()
|
||||
{
|
||||
// Must use the model to create the database structure as there is no
|
||||
// creation of tables in controller
|
||||
// Must use the model to create the database structure as there is no
|
||||
// creation of tables in controller
|
||||
$authz = new Authzgroupsoo();
|
||||
$res = $authz->connect(
|
||||
$this->dbconfig["dsn"],
|
||||
@@ -99,7 +102,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["password"],
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
// The object was renamed and is not available
|
||||
// The object was renamed and is not available
|
||||
$this->setExpectedException("Exception");
|
||||
$res = $authz->objectDel("MODULE", "/object");
|
||||
}
|
||||
@@ -142,7 +145,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["password"],
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
// The group doesn't exists
|
||||
// The group doesn't exists
|
||||
$this->setExpectedException("Exception");
|
||||
$res = $authz->groupDel("MODULE", "group");
|
||||
}
|
||||
@@ -159,7 +162,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["password"],
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
// The group doesn't exists
|
||||
// The group doesn't exists
|
||||
$this->setExpectedException("Exception");
|
||||
$res = $authz->groupmemberAdd("MODULE", "group", "userKnown");
|
||||
}
|
||||
@@ -186,7 +189,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["password"],
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
// The group doesn't exists
|
||||
// The group doesn't exists
|
||||
$this->setExpectedException("Exception");
|
||||
$res = $authz->groupmemberDel("MODULE", "group", "userKnown");
|
||||
}
|
||||
@@ -200,7 +203,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["password"],
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
// The group doesn't exists
|
||||
// The group doesn't exists
|
||||
$this->setExpectedException("Exception");
|
||||
$res = $authz->groupmemberReadGroup("MODULE", "group");
|
||||
}
|
||||
@@ -215,7 +218,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
$res = $authz->groupmemberReadGroup("MODULE", "group2");
|
||||
$this->assertSame(array (array ("user" => "userKnown")), $res);
|
||||
$this->assertSame([["user" => "userKnown"]], $res);
|
||||
}
|
||||
|
||||
public function testGroupmemberReadUser1()
|
||||
@@ -228,7 +231,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
$res = $authz->groupmemberReadUser("MODULE", "userKnown");
|
||||
$this->assertSame(array (1 => "group2"), $res);
|
||||
$this->assertSame([1 => "group2"], $res);
|
||||
}
|
||||
|
||||
////////////////
|
||||
@@ -269,7 +272,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["password"],
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
// The object doesn't exists
|
||||
// The object doesn't exists
|
||||
$this->setExpectedException("Exception");
|
||||
$res = $authz->rightDel("MODULE", "group2", "/object");
|
||||
}
|
||||
@@ -329,7 +332,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$this->dbconfig["password"],
|
||||
$this->dbconfig["driver_options"]
|
||||
);
|
||||
// Create infos to tests the userrightsget method
|
||||
// Create infos to tests the userrightsget method
|
||||
$authz->objectAdd("MODULE1", "/");
|
||||
$authz->objectAdd("MODULE1", "/rep1");
|
||||
$authz->objectAdd("MODULE1", "/rep1/rep2");
|
||||
@@ -349,7 +352,7 @@ class AuthzgroupsooTest extends \PHPUnit_Framework_TestCase
|
||||
$authz->rightAdd("MODULE1", "group3", "/rep1/rep2", "RO");
|
||||
|
||||
$res = $authz->userrightsget("MODULE1", "userKnown");
|
||||
$this->assertSame(array ("/rep1/rep2" => "RW"), $res);
|
||||
$this->assertSame(["/rep1/rep2" => "RW"], $res);
|
||||
}
|
||||
|
||||
public function testAllow1()
|
||||
|
||||
Reference in New Issue
Block a user