Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
aff96e50
Commit
aff96e50
authored
12 years ago
by
Marcos García de La Fuente
Browse files
Options
Downloads
Patches
Plain Diff
Added test for functions fetch_login and resiliate
parent
729a8017
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/phpunit/AdherentTest.php
+72
-12
72 additions, 12 deletions
test/phpunit/AdherentTest.php
with
72 additions
and
12 deletions
test/phpunit/AdherentTest.php
+
72
−
12
View file @
aff96e50
...
@@ -162,7 +162,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -162,7 +162,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
}
}
/**
/**
* testAdherent
Update
* testAdherent
FetchLogin
*
*
* @param Adherent $localobject Member instance
* @param Adherent $localobject Member instance
* @return Adherent
* @return Adherent
...
@@ -170,6 +170,31 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -170,6 +170,31 @@ class AdherentTest extends PHPUnit_Framework_TestCase
* @depends testAdherentFetch
* @depends testAdherentFetch
* The depends says test is run only if previous is ok
* The depends says test is run only if previous is ok
*/
*/
public
function
testAdherentFetchLogin
(
Adherent
$localobject
)
{
global
$conf
,
$user
,
$langs
,
$db
;
$conf
=
$this
->
savconf
;
$user
=
$this
->
savuser
;
$langs
=
$this
->
savlangs
;
$db
=
$this
->
savdb
;
$newobject
=
new
Adherent
(
$this
->
savdb
);
$result
=
$newobject
->
fetch_login
(
$localobject
->
login
);
$this
->
assertEquals
(
$newobject
,
$localobject
);
return
$localobject
;
}
/**
* testAdherentUpdate
*
* @param Adherent $localobject Member instance
* @return Adherent
*
* @depends testAdherentFetchLogin
* The depends says test is run only if previous is ok
*/
public
function
testAdherentUpdate
(
Adherent
$localobject
)
public
function
testAdherentUpdate
(
Adherent
$localobject
)
{
{
global
$conf
,
$user
,
$langs
,
$db
;
global
$conf
,
$user
,
$langs
,
$db
;
...
@@ -259,7 +284,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -259,7 +284,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
'%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%,%EMAIL%,%NAISS%,%PHOTO%,%LOGIN%,%PASSWORD%,%PRENOM%,'
.
'%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%,%EMAIL%,%NAISS%,%PHOTO%,%LOGIN%,%PASSWORD%,%PRENOM%,'
.
'%NOM%,%SOCIETE%,%ADRESSE%,%CP%,%VILLE%,%PAYS%'
;
'%NOM%,%SOCIETE%,%ADRESSE%,%CP%,%VILLE%,%PAYS%'
;
$expected
=
DOL_MAIN_URL_ROOT
.
','
.
$localobject
->
id
.
',
0
,New firstname,New name,New firstname New name,'
.
$expected
=
DOL_MAIN_URL_ROOT
.
','
.
$localobject
->
id
.
',,New firstname,New name,New firstname New name,'
.
'New company,New address,New zip,New town,Belgium,newemail@newemail.com,'
.
dol_print_date
(
$localobject
->
naiss
,
'day'
)
.
',,'
.
'New company,New address,New zip,New town,Belgium,newemail@newemail.com,'
.
dol_print_date
(
$localobject
->
naiss
,
'day'
)
.
',,'
.
'newlogin,dolibspec,New firstname,New name,New company,New address,New zip,New town,Belgium'
;
'newlogin,dolibspec,New firstname,New name,New company,New address,New zip,New town,Belgium'
;
...
@@ -370,7 +395,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -370,7 +395,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
* @depends testAdherentSetThirdPartyId
* @depends testAdherentSetThirdPartyId
* The depends says test is run only if previous is ok
* The depends says test is run only if previous is ok
*/
*/
public
function
testAdherentValid
(
Adherent
$localobject
)
public
function
testAdherentValid
ate
(
Adherent
$localobject
)
{
{
global
$conf
,
$user
,
$langs
,
$db
;
global
$conf
,
$user
,
$langs
,
$db
;
$conf
=
$this
->
savconf
;
$conf
=
$this
->
savconf
;
...
@@ -391,7 +416,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -391,7 +416,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
* @param Adherent $localobject Member instance
* @param Adherent $localobject Member instance
* @return int Id of object
* @return int Id of object
*
*
* @depends testAdherentValid
* @depends testAdherentValid
ate
* The depends says test is run only if previous is ok
* The depends says test is run only if previous is ok
*/
*/
public
function
testAdherentOther
(
Adherent
$localobject
)
public
function
testAdherentOther
(
Adherent
$localobject
)
...
@@ -411,19 +436,56 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -411,19 +436,56 @@ class AdherentTest extends PHPUnit_Framework_TestCase
print
__METHOD__
.
" localobject->date_creation="
.
$localobject
->
date_creation
.
"
\n
"
;
print
__METHOD__
.
" localobject->date_creation="
.
$localobject
->
date_creation
.
"
\n
"
;
$this
->
assertNotEquals
(
$localobject
->
date_creation
,
''
);
$this
->
assertNotEquals
(
$localobject
->
date_creation
,
''
);
return
$localobject
->
id
;
return
$localobject
;
}
/**
* testAdherentResiliate
*
* @param Adherent $localobject Member instance
* @return Adherent
*
* @depends testAdherentOther
* The depends says test is run only if previous is ok
*/
public
function
testAdherentResiliate
(
Adherent
$localobject
)
{
global
$conf
,
$user
,
$langs
,
$db
;
$conf
=
$this
->
savconf
;
$user
=
$this
->
savuser
;
$langs
=
$this
->
savlangs
;
$db
=
$this
->
savdb
;
//Let's resilie un adherent
$result
=
$localobject
->
resiliate
(
$user
);
print
__METHOD__
.
" id="
.
$localobject
->
id
.
" result="
.
$result
.
"
\n
"
;
$this
->
assertEquals
(
$result
,
1
);
//Is statut updated?
$this
->
assertEquals
(
$localobject
->
statut
,
0
);
//We update the object and let's check if it was updated on DB
$localobject
->
fetch
(
$localobject
->
id
);
$this
->
assertEquals
(
$localobject
->
statut
,
0
);
//Now that status=0, resiliate should return 0
$result
=
$localobject
->
resiliate
(
$user
);
print
__METHOD__
.
" id="
.
$localobject
->
id
.
" result="
.
$result
.
"
\n
"
;
$this
->
assertEquals
(
$result
,
0
);
return
$localobject
;
}
}
/**
/**
* testAdherentDelete
* testAdherentDelete
*
*
* @param
int $id Id of object to delet
e
* @param
Adherent $localobject Member instanc
e
* @return void
* @return void
*
*
* @depends testAdherent
Other
* @depends testAdherent
Resiliate
* The depends says test is run only if previous is ok
* The depends says test is run only if previous is ok
*/
*/
public
function
testAdherentDelete
(
$
id
)
public
function
testAdherentDelete
(
$
localobject
)
{
{
global
$conf
,
$user
,
$langs
,
$db
;
global
$conf
,
$user
,
$langs
,
$db
;
$conf
=
$this
->
savconf
;
$conf
=
$this
->
savconf
;
...
@@ -431,10 +493,8 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -431,10 +493,8 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$langs
=
$this
->
savlangs
;
$langs
=
$this
->
savlangs
;
$db
=
$this
->
savdb
;
$db
=
$this
->
savdb
;
$localobject
=
new
Adherent
(
$this
->
savdb
);
$result
=
$localobject
->
delete
(
$localobject
->
id
);
$result
=
$localobject
->
fetch
(
$id
);
print
__METHOD__
.
" id="
.
$localobject
->
id
.
" result="
.
$result
.
"
\n
"
;
$result
=
$localobject
->
delete
(
$id
);
print
__METHOD__
.
" id="
.
$id
.
" result="
.
$result
.
"
\n
"
;
$this
->
assertLessThan
(
$result
,
0
);
$this
->
assertLessThan
(
$result
,
0
);
return
$result
;
return
$result
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment