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
5b4f1d39
Commit
5b4f1d39
authored
12 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Plain Diff
Merge pull request #591 from marcosgdf/test
Improved AdherentTest and added testAdherentMakeSubstitution
parents
63cd0e89
88fdfec0
Branches
Branches containing commit
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
+45
-4
45 additions, 4 deletions
test/phpunit/AdherentTest.php
with
45 additions
and
4 deletions
test/phpunit/AdherentTest.php
+
45
−
4
View file @
5b4f1d39
<?php
<?php
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -169,7 +170,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -169,7 +170,7 @@ 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
testAdherentUpdate
(
$localobject
)
public
function
testAdherentUpdate
(
Adherent
$localobject
)
{
{
global
$conf
,
$user
,
$langs
,
$db
;
global
$conf
,
$user
,
$langs
,
$db
;
$conf
=
$this
->
savconf
;
$conf
=
$this
->
savconf
;
...
@@ -177,6 +178,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -177,6 +178,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$langs
=
$this
->
savlangs
;
$langs
=
$this
->
savlangs
;
$db
=
$this
->
savdb
;
$db
=
$this
->
savdb
;
$timestamp
=
dol_now
();
$localobject
->
civilite_id
=
0
;
$localobject
->
login
=
'newlogin'
;
$localobject
->
login
=
'newlogin'
;
$localobject
->
societe
=
'New company'
;
$localobject
->
societe
=
'New company'
;
$localobject
->
note
=
'New note after update'
;
$localobject
->
note
=
'New note after update'
;
...
@@ -188,10 +192,12 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -188,10 +192,12 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$localobject
->
town
=
'New town'
;
$localobject
->
town
=
'New town'
;
$localobject
->
country_id
=
2
;
$localobject
->
country_id
=
2
;
$localobject
->
statut
=
0
;
$localobject
->
statut
=
0
;
$localobject
->
morphy
=
0
;
$localobject
->
phone
=
'New tel pro'
;
$localobject
->
phone
=
'New tel pro'
;
$localobject
->
phone_perso
=
'New tel perso'
;
$localobject
->
phone_perso
=
'New tel perso'
;
$localobject
->
phone_mobile
=
'New tel mobile'
;
$localobject
->
phone_mobile
=
'New tel mobile'
;
$localobject
->
email
=
'newemail@newemail.com'
;
$localobject
->
email
=
'newemail@newemail.com'
;
$localobject
->
naiss
=
$timestamp
;
$result
=
$localobject
->
update
(
$user
);
$result
=
$localobject
->
update
(
$user
);
print
__METHOD__
.
" id="
.
$localobject
->
id
.
" result="
.
$result
.
"
\n
"
;
print
__METHOD__
.
" id="
.
$localobject
->
id
.
" result="
.
$result
.
"
\n
"
;
$this
->
assertLessThan
(
$result
,
0
);
$this
->
assertLessThan
(
$result
,
0
);
...
@@ -207,6 +213,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -207,6 +213,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
print
__METHOD__
.
" id="
.
$localobject
->
id
.
" result="
.
$result
.
"
\n
"
;
print
__METHOD__
.
" id="
.
$localobject
->
id
.
" result="
.
$result
.
"
\n
"
;
$this
->
assertLessThan
(
$result
,
0
);
$this
->
assertLessThan
(
$result
,
0
);
$this
->
assertEquals
(
$localobject
->
civilite_id
,
$newobject
->
civilite_id
);
$this
->
assertEquals
(
$localobject
->
login
,
$newobject
->
login
);
$this
->
assertEquals
(
$localobject
->
login
,
$newobject
->
login
);
$this
->
assertEquals
(
$localobject
->
societe
,
$newobject
->
societe
);
$this
->
assertEquals
(
$localobject
->
societe
,
$newobject
->
societe
);
$this
->
assertEquals
(
$localobject
->
note
,
$newobject
->
note
);
$this
->
assertEquals
(
$localobject
->
note
,
$newobject
->
note
);
...
@@ -223,12 +230,14 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -223,12 +230,14 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$localobject
->
phone_perso
,
$newobject
->
phone_perso
);
$this
->
assertEquals
(
$localobject
->
phone_perso
,
$newobject
->
phone_perso
);
$this
->
assertEquals
(
$localobject
->
phone_mobile
,
$newobject
->
phone_mobile
);
$this
->
assertEquals
(
$localobject
->
phone_mobile
,
$newobject
->
phone_mobile
);
$this
->
assertEquals
(
$localobject
->
email
,
$newobject
->
email
);
$this
->
assertEquals
(
$localobject
->
email
,
$newobject
->
email
);
$this
->
assertEquals
(
$localobject
->
naiss
,
$timestamp
);
$this
->
assertEquals
(
$localobject
->
morphy
,
$newobject
->
morphy
);
return
$localobject
;
return
$localobject
;
}
}
/**
/**
* testAdherent
Valid
* testAdherent
MakeSubstitution
*
*
* @param Adherent $localobject Member instance
* @param Adherent $localobject Member instance
* @return Adherent
* @return Adherent
...
@@ -236,7 +245,39 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -236,7 +245,39 @@ class AdherentTest extends PHPUnit_Framework_TestCase
* @depends testAdherentUpdate
* @depends testAdherentUpdate
* 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
(
$localobject
)
public
function
testAdherentMakeSubstitution
(
Adherent
$localobject
)
{
global
$conf
,
$user
,
$langs
,
$db
;
$conf
=
$this
->
savconf
;
$user
=
$this
->
savuser
;
$langs
=
$this
->
savlangs
;
$db
=
$this
->
savdb
;
$template
=
'%DOL_MAIN_URL_ROOT%,%ID%,%CIVILITE%,%FIRSTNAME%,%LASTNAME%,%FULLNAME%,%COMPANY%,'
.
'%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%,%EMAIL%,%NAISS%,%PHOTO%,%LOGIN%,%PASSWORD%,%PRENOM%,'
.
'%NOM%,%SOCIETE%,%ADRESSE%,%CP%,%VILLE%,%PAYS%'
;
$expected
=
DOL_MAIN_URL_ROOT
.
','
.
$localobject
->
id
.
',0,New firstname,New name,New firstname New name,'
.
'New company,New address,New zip,New town,,newemail@newemail.com,'
.
dol_print_date
(
$localobject
->
naiss
,
'day'
)
.
',,'
.
'newlogin,dolibspec,New firstname,New name,New company,New address,New zip,New town,'
;
$result
=
$localobject
->
makeSubstitution
(
$template
);
print
__METHOD__
.
" result="
.
$result
.
"
\n
"
;
$this
->
assertEquals
(
$expected
,
$result
);
return
$localobject
;
}
/**
* testAdherentValid
*
* @param Adherent $localobject Member instance
* @return Adherent
*
* @depends testAdherentMakeSubstitution
* The depends says test is run only if previous is ok
*/
public
function
testAdherentValid
(
Adherent
$localobject
)
{
{
global
$conf
,
$user
,
$langs
,
$db
;
global
$conf
,
$user
,
$langs
,
$db
;
$conf
=
$this
->
savconf
;
$conf
=
$this
->
savconf
;
...
@@ -260,7 +301,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
...
@@ -260,7 +301,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
* @depends testAdherentValid
* @depends testAdherentValid
* 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
(
$localobject
)
public
function
testAdherentOther
(
Adherent
$localobject
)
{
{
global
$conf
,
$user
,
$langs
,
$db
;
global
$conf
,
$user
,
$langs
,
$db
;
$conf
=
$this
->
savconf
;
$conf
=
$this
->
savconf
;
...
...
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