mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 17:13:03 +01:00
Add phpunit test
This commit is contained in:
@@ -77,7 +77,7 @@ class UserTest extends PHPUnit_Framework_TestCase
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
if (! empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); }
|
||||
|
||||
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
@@ -272,6 +272,32 @@ class UserTest extends PHPUnit_Framework_TestCase
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* testUserAddPermission
|
||||
*
|
||||
* @param Object $id User
|
||||
* @return void
|
||||
* @depends testUserDelete
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testUserAddPermission($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$localobject=new User($this->savdb);
|
||||
$result=$localobject->fetch(1); // Other tests use the user id 1
|
||||
$result=$localobject->addrights(0, 'supplier_proposal');
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Edit an object to test updates
|
||||
|
||||
Reference in New Issue
Block a user