Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
don
Commits
fb136c4c
Commit
fb136c4c
authored
Nov 12, 2018
by
Okhin
Browse files
Lot's pf work, need to finish the Counterpart handlers and commands
parent
1741937a
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controller/admin.php
View file @
fb136c4c
...
...
@@ -209,6 +209,7 @@ class Admin extends Controller
if
(
$f3
->
exists
(
'PARAMS.id'
))
{
$id
=
$f3
->
get
(
'PARAMS.id'
);
}
$f3
->
set
(
'block_content'
,
'backend/don.html'
);
}
else
{
$id
=
$f3
->
get
(
'POST.id'
);
$pseudo
=
$f3
->
get
(
'POST.pseudo'
);
...
...
@@ -267,11 +268,6 @@ class Admin extends Controller
1)"
);
// Récupération de l'id pour passage en mode édition
$id
=
$db
->
lastInsertId
();
if
(
$adresse_id
!=
''
)
{
$db
->
query
(
"UPDATE dons
SET adresse_id =
$adresse_id
WHERE id =
$id
"
);
}
}
else
{
// We will get the ids associated to the gift first
$result
=
$db
->
query
(
"SELECT adresse_id,
...
...
@@ -280,26 +276,6 @@ class Admin extends Controller
WHERE id = "
.
\
Utils
::
asl
(
$f3
->
get
(
'POST.id'
)));
$result
=
$result
->
fetch
(
\
PDO
::
FETCH_ASSOC
);
// Let's update the adresse first or create the adress
if
(
$result
[
'adresse_id'
]
==
'0'
)
{
$db
->
query
(
"INSERT INTO adresses
(nom, adresse, adresse2, codepostal, ville, pays)
VALUES ('"
.
\
Utils
::
asl
(
$nom
)
.
"',
'"
.
\
Utils
::
asl
(
$adresse
)
.
"',
'"
.
\
Utils
::
asl
(
$adresse2
)
.
"',
'"
.
\
Utils
::
asl
(
$codepostal
)
.
"',
'"
.
\
Utils
::
asl
(
$ville
)
.
"',
'"
.
\
Utils
::
asl
(
$pays
)
.
"')"
);
$result
[
'adresse_id'
]
=
$db
->
lastInsertId
();
}
else
{
$db
->
query
(
"UPDATE adresses
SET nom='"
.
\
Utils
::
asl
(
$nom
)
.
"',
adresse='"
.
\
Utils
::
asl
(
$adresse
)
.
"',
adresse2='"
.
\
Utils
::
asl
(
$adresse2
)
.
"',
codepostal='"
.
\
Utils
::
asl
(
$codepostal
)
.
"',
ville='"
.
\
Utils
::
asl
(
$ville
)
.
"',
pays='"
.
\
Utils
::
asl
(
$pays
)
.
"'
WHERE id=
{
$result
[
'adresse_id'
]
}
"
);
}
$db
->
query
(
"UPDATE users
SET email='"
.
\
Utils
::
asl
(
$email
)
.
"',
pseudo='"
.
\
Utils
::
asl
(
$pseudo
)
.
"'
...
...
@@ -663,17 +639,17 @@ class Admin extends Controller
ville='"
.
\
Utils
::
asl
(
$ville
)
.
"',
pays='"
.
\
Utils
::
asl
(
$pays
)
.
"')"
);
$adresse_id
=
$db
->
lastInsertId
();
}
// Updating the
adresses
first
$db
->
query
(
"UPDATE adresses
SET nom
='"
.
\
Utils
::
asl
(
$
nom
)
.
"',
adresse='"
.
\
Utils
::
asl
(
$adresse
)
.
"',
adresse2
='"
.
\
Utils
::
asl
(
$
adresse2
)
.
"',
codepostal
='"
.
\
Utils
::
asl
(
$
codepostal
)
.
"',
ville
='"
.
\
Utils
::
asl
(
$
ville
)
.
"'
,
pays='"
.
\
Utils
::
asl
(
$pays
)
.
"'
WHERE id =
$adresse_id
"
)
;
}
else
{
// Updating the adresses first
$db
->
query
(
"UPDATE
adresses
SET nom='"
.
\
Utils
::
asl
(
$nom
)
.
"',
adresse
='"
.
\
Utils
::
asl
(
$
adresse
)
.
"',
adresse
2
='"
.
\
Utils
::
asl
(
$adresse
2
)
.
"',
codepostal
='"
.
\
Utils
::
asl
(
$
codepostal
)
.
"',
ville
='"
.
\
Utils
::
asl
(
$
ville
)
.
"',
pays
='"
.
\
Utils
::
asl
(
$
pays
)
.
"'
WHERE id =
$adresse_id
"
);
}
;
$db
->
query
(
"UPDATE contreparties
SET quoi='"
.
\
Utils
::
asl
(
$quoi
)
.
"',
taille='"
.
\
Utils
::
asl
(
$taille
)
.
"',
...
...
@@ -684,27 +660,8 @@ class Admin extends Controller
}
}
$contrepartie
=
array
();
if
(
$id
!=
''
)
{
// Récupération de la contrepartie
$result
=
$db
->
query
(
"SELECT c.id AS id,
c.user_id AS user_id,
c.quoi AS quoi,
c.taille AS taille,
c.status AS status,
a.nom AS nom,
a.adresse AS adresse,
a.codepostal AS codepostal,
a.ville AS ville,
a.pays AS pays,
u.commentaire AS commentaire
FROM contreparties c
JOIN users u ON c.user_id = u.id
LEFT JOIN adresses a ON c.adresse_id = a.id
WHERE c.id="
.
$id
);
if
(
$result
->
fetch
(
\
PDO
::
FETCH_ASSOC
))
{
$contrepartie
=
$result
->
fetch
(
\
PDO
::
FETCH_ASSOC
);
}
$contrepartie
=
$f3
->
get
(
'container'
)[
'counterpart_finder'
]
->
findById
((
int
)
$id
);
}
else
{
$contrepartie
=
array
(
'id'
=>
$id
,
...
...
@@ -815,7 +772,7 @@ class Admin extends Controller
// Let's get everything we have related to our user
$user
=
$f3
->
get
(
'container'
)[
'user_finder'
]
->
findById
(
$id
);
$user
[
'adresse
s
'
]
=
$f3
->
get
(
'container'
)[
'address_finder'
]
->
findByUserId
(
$user
[
'id'
]);
$user
[
'adresse'
]
=
$f3
->
get
(
'container'
)[
'address_finder'
]
->
findByUserId
(
$user
[
'id'
]);
$user
[
'dons'
]
=
$f3
->
get
(
'container'
)[
'donation_finder'
]
->
findByUserId
(
$user
[
'id'
]);
$user
[
'contreparties'
]
=
$f3
->
get
(
'container'
)[
'counterpart_finder'
]
->
findByUserId
(
$user
[
'id'
]);
...
...
app/view/backend/base.html
View file @
fb136c4c
<include
href=
"backend/header.html"
/>
<include
href=
"backend/toolbar.html"
/>
<include
href=
"{{ @block_content }}"
/>
<include
href=
"backend/footer.html"
/>
<!--
<include href="backend/footer.html" />
<!-- No need for scripts right now -->
app/view/backend/contrepartie.html
View file @
fb136c4c
...
...
@@ -7,13 +7,13 @@
<h2>
Ajout d'une contrepartie
</h2>
</false>
</check>
<form
name=
"f"
method=
"POST"
action=
"{{ 'edit_counterpart', 'id='
+
@id | alias }}"
>
<form
name=
"f"
method=
"POST"
action=
"{{ 'edit_counterpart', 'id='
.
@id | alias }}"
>
<input
type=
"hidden"
name=
"taille"
id=
"taille"
value=
"{{ @contrepartie.taille }}"
/>
<input
type=
"hidden"
name=
"user_id"
id=
"user_id"
value=
"{{ @contrepartie.user_id }}"
/>
<input
type=
"hidden"
id=
"csrf"
name=
"csrf"
value=
"{{ @CSRF }}"
/>
<label
for=
"quoi"
>
Quoi
</label>
<select
id=
"quoi"
name=
"quoi"
onchange=
"select_span()"
>
<select
id=
"quoi"
name=
"quoi"
>
<option
value=
"piplome"
<
check
if=
"{{ @contrepartie.quoi=='piplome' }}"
>
selected
</check>
>piplome
</option>
<option
value=
"pishirt"
<
check
if=
"{{ @contrepartie.quoi=='pishirt' }}"
>
selected
</check>
>pishirt
</option>
<option
value=
"hoodie"
<
check
if=
"{{ @contrepartie.quoi=='hoodie' }}"
>
selected
</check>
>hoodie
</option>
...
...
@@ -22,15 +22,15 @@
<span
id=
"quoi_taille"
>
<label
for=
"size"
>
Taille
</label>
<select
id=
"size"
name=
"size"
onchange=
"select_taille()"
>
<repeat
group=
"{{ @
TAILLES
}}"
key=
"{{ @key }}"
value=
"{{ @value }}"
>
<select
id=
"size"
name=
"size"
>
<repeat
group=
"{{ @
atailles
}}"
key=
"{{ @key }}"
value=
"{{ @value }}"
>
<option
value=
"{{ @key }}"
<
check
if=
"{{ @contrepartie.taille==@key }}"
>
selected
</check>
>{{ @value }}
</option>
</repeat>
</select>
</span>
<span
id=
"quoi_pdf"
>
<label
for=
"url"
>
Pdf
</label>
<select
id=
"url"
name=
"url"
onchange=
"select_taille()"
>
<select
id=
"url"
name=
"url"
>
<repeat
group=
"{{ @pdfs }}"
value=
"{{ @pdf }}"
>
<option
value=
"{{ @pdf.id }}"
<
check
if=
"{{ @contrepartie.taille==@pdf.id }}"
>
selected
</check>
>{{ @pdf.pdf }} / {{ @pdf.nom }}
</option>
</repeat>
...
...
@@ -43,7 +43,11 @@
<br
/>
<label
for=
"adresse"
>
Adresse
</label>
<textarea
id=
"adresse"
name=
"adresse"
cols=
"30"
rows=
"2"
>
{{ @contrepartie.adresse }}
</textarea>
<input
type=
"text"
id=
"adresse"
name=
"adresse"
size=
"60"
value=
"{{ @contrepartie.adresse }}"
>
<br
/>
<label
for=
"adresse"
>
Complément d'adresse
</label>
<input
type=
"text"
id=
"adresse2"
name=
"adresse2"
size=
"60"
value=
"{{ @contrepartie.adresse2 }}"
>
<br
/>
<label
for=
"codepostal"
>
Code postal
</label>
...
...
@@ -65,7 +69,7 @@
</select>
<br
/>
<label
for=
commentaire"
>
Commentaire
</label>
<label
for=
"
commentaire"
>
Commentaire
</label>
<textarea
type=
"textarea"
id=
"commentaire"
name=
"commentaire"
cols=
"30"
rows=
"2"
>
{{ @contrepartie.commentaire }}
</textarea>
<br
/>
...
...
app/view/backend/contreparties.html
View file @
fb136c4c
...
...
@@ -71,14 +71,14 @@
</true>
<false>
{{ @
TAILLES
[@row.taille] }}
{{ @
atailles
[@row.taille] }}
</false>
</check>
</false>
</check>
</td>
<td>
{{ @row.
nom
}}
<br
/>
{{ @row.
pseudo
}}
<br
/>
{{ @row.adresse }}
<br
/>
{{ @row.adresse2 }}
<br
/>
{{ @row.codepostal }} {{ @row.ville }}
<br
/>
...
...
app/view/backend/dons.html
View file @
fb136c4c
...
...
@@ -55,8 +55,8 @@
<tr>
<td>
{{ @row.id }}
</td>
<td
class=
"inline"
>
{{ @row.datec }}
</td>
<td>
{{ @row.
nom
}}
</td>
<td><a
href=
"{{ 'user_info','id='.@row.user_id | alias }}"
>
{{ @row.email }}
</a></td>
<td>
{{ @row.
pseudo
}}
</td>
<td><a
href=
"{{ 'user_info','id='.@row.user_id | alias }}"
>
{{ @row.email }}
</a></td>
<td>
{{ @row.somme }}
</td>
<td>
{{ @row.adresse }}
<br
/>
...
...
@@ -71,12 +71,12 @@
-
<check
if=
"{{ @row.status==0 || @row.status==100 }}"
>
<true>
<span
class=
"lien"
onclick=
"valid({{ @row.id
}}
)
"
>
Valider
</
span
>
<a
href=
"{{ 'validate_support', 'id='.@row.id | alias
}}"
>
Valider
</
a
>
</true>
<false>
<
span
class=
"lien"
onclick=
"invalid({{ @row.id
}}
)
"
>
Invalider
</
span
>
<
a
href=
"{{ 'invalidate_support', 'id='.@row.id | alias
}}"
>
Invalider
</
a
>
-
<
span
class=
"lien"
onclick=
"pdf({{ @row.id
}}
)
"
>
PDF
</
span
>
<
a
href=
"{{ 'validate_support', 'id='.@row.id | alias
}}"
>
PDF
</
a
>
</false>
</check>
</td>
...
...
app/view/backend/user.html
View file @
fb136c4c
...
...
@@ -35,52 +35,50 @@
<br
/>
</section>
<section
id=
"adresses"
>
<h2>
Adresses associées à cet utilisateur
</h2>
<repeat
group=
"{{ @user.adresses }}"
value=
"{{ @adresse }}"
counter=
"{{ @i }}"
>
<h3>
{{ @i }}
&
nbsp:{{ @adresse.alias }}
</h3>
<form
name=
"addr_{{@id }}"
method=
"POST"
action=
"{{ 'adresse' |alias }}"
>
<input
type=
"hidden"
id=
"csrf"
name=
"csrf"
value=
"{{ @CSRF }}"
/>
<input
type=
"hidden"
name=
"id"
id=
"id"
value=
"{{ @adresse.id }}"
/>
<input
type=
"hidden"
name=
"action"
id=
"action"
value=
"modify"
/>
<label
for=
"nom"
>
Nom
</label>
<input
type=
"text"
id=
"nom"
name=
"nom"
size=
"30"
value=
"{{ @adresse.nom }}"
/>
<br
/>
<label
for=
"adresse"
>
Adresse
</label>
<input
type=
"text"
id=
"adresse"
name=
"adresse"
size=
"100"
value=
"{{ @adresse.adresse }}"
/>
<br
/>
<label
for=
"adresse2"
>
Adresse (compl.)
</label>
<input
type=
"text"
id=
"adresse2"
name=
"adresse2"
size=
"100"
value=
"{{ @adresse.adresse2 }}"
/>
<br
/>
<label
for=
"codepostal"
>
Code Postal
</label>
<input
type=
"text"
id=
"codepostal"
name=
"codepostal"
size=
"10"
value=
"{{ @adresse.codepostal }}"
/>
<br
/>
<label
for=
"ville"
>
Ville
</label>
<input
type=
"text"
id=
"ville"
name=
"ville"
size=
"50"
value=
"{{ @adresse.ville }}"
/>
<br
/>
<label
for=
"etat"
>
Etat / Province / Comté
</label>
<input
type=
"text"
id=
"etat"
name=
"etat"
size=
"50"
value=
"{{ @adresse.etat }}"
/>
<br
/>
<label
for=
"pays"
>
Pays
</label>
<input
type=
"text"
id=
"pays"
name=
"pays"
size=
"30"
value=
"{{ @adresse.pays }}"
/>
<br
/>
<input
type=
"submit"
value=
"Modifier l'adresse"
/>
</form>
<form
name=
"del_addr_{{@id}}"
method=
"POST"
action=
"{{ 'adresse' | alias }}"
>
<input
type=
"hidden"
id=
"csrf"
name=
"csrf"
value=
"{{ @CSRF }}"
/>
<input
type=
"hidden"
name=
"id"
id=
"id"
value=
"{{ @adresse.id }}"
/>
<input
type=
"hidden"
name=
"action"
id=
"action"
value=
"delete"
/>
<input
type=
"submit"
value=
"Effacer l'adresse"
/>
</form>
</repeat>
<h2>
Adresse postale de cet utilisateur
</h2>
<check
if=
"@@user.adresse"
>
<form
name=
"addr_{{@id }}"
method=
"POST"
action=
"{{ 'adresse' |alias }}"
>
<input
type=
"hidden"
id=
"csrf"
name=
"csrf"
value=
"{{ @CSRF }}"
/>
<input
type=
"hidden"
name=
"id"
id=
"id"
value=
"{{ @@user.adresse.id }}"
/>
<input
type=
"hidden"
name=
"action"
id=
"action"
value=
"modify"
/>
<label
for=
"nom"
>
Nom
</label>
<input
type=
"text"
id=
"nom"
name=
"nom"
size=
"30"
value=
"{{ @@user.adresse.nom }}"
/>
<br
/>
<label
for=
"adresse"
>
Adresse
</label>
<input
type=
"text"
id=
"adresse"
name=
"adresse"
size=
"100"
value=
"{{ @@user.adresse.adresse }}"
/>
<br
/>
<label
for=
"adresse2"
>
Adresse (compl.)
</label>
<input
type=
"text"
id=
"adresse2"
name=
"adresse2"
size=
"100"
value=
"{{ @@user.adresse.adresse2 }}"
/>
<br
/>
<label
for=
"codepostal"
>
Code Postal
</label>
<input
type=
"text"
id=
"codepostal"
name=
"codepostal"
size=
"10"
value=
"{{ @@user.adresse.codepostal }}"
/>
<br
/>
<label
for=
"ville"
>
Ville
</label>
<input
type=
"text"
id=
"ville"
name=
"ville"
size=
"50"
value=
"{{ @@user.adresse.ville }}"
/>
<br
/>
<label
for=
"etat"
>
Etat / Province / Comté
</label>
<input
type=
"text"
id=
"etat"
name=
"etat"
size=
"50"
value=
"{{ @@user.adresse.etat }}"
/>
<br
/>
<label
for=
"pays"
>
Pays
</label>
<input
type=
"text"
id=
"pays"
name=
"pays"
size=
"30"
value=
"{{ @@user.adresse.pays }}"
/>
<br
/>
<input
type=
"submit"
value=
"Modifier l'adresse"
/>
</form>
<form
name=
"del_addr_{{@id}}"
method=
"POST"
action=
"{{ 'adresse' | alias }}"
>
<input
type=
"hidden"
id=
"csrf"
name=
"csrf"
value=
"{{ @CSRF }}"
/>
<input
type=
"hidden"
name=
"id"
id=
"id"
value=
"{{ @@user.adresse.id }}"
/>
<input
type=
"hidden"
name=
"action"
id=
"action"
value=
"delete"
/>
<input
type=
"submit"
value=
"Effacer l'adresse"
/>
</form>
</check>
</section>
<section
id=
"contreparties"
>
<check
if=
"{{ count(@user.contreparties) > 0}}"
>
...
...
@@ -123,7 +121,7 @@
<td>
<check
if=
"{{ @row.adresse_id != null }}"
>
<true>
{{ @user.adresses[@row.adresse_id].
alias
}}
{{
@
@user.adresses[@row.adresse_id].
nom
}}
</true>
<false>
-
...
...
@@ -174,7 +172,6 @@
<th>
ID
</th>
<th>
Date
</th>
<th>
Don
</th>
<th>
Adresse
</th>
<th>
PDF
</th>
<th>
Statut
</th>
<th>
Actions
</th>
...
...
@@ -185,16 +182,6 @@
<td>
{{ @row.id }}
</td>
<td
class=
"inline"
>
{{ @row.datec }}
</td>
<td>
{{ @row.somme }}
</td>
<td>
<check
if=
"{{ array_key_exists(@row.adresse_id, @user.adresses)}}"
>
<true>
{{ @user.adresses[@row.adresse_id].alias }}
</true>
<false>
</false>
</check>
</td>
<td>
<check
if=
"{{ @row.pdf == '' }}"
>
<true>
...
...
src/LQDN/Command/CounterpartCreateCommand.php
0 → 100644
View file @
fb136c4c
<?php
namespace
LQDN\Command
;
class
CounterPartCreateCommand
{
private
$counterpartId
;
private
$adresseId
;
private
$userId
;
private
$quoi
;
private
$taille
;
private
$status
;
private
$date
;
public
function
__construct
(
$adresseId
,
$userId
,
$quoi
,
$taille
,
$status
,
$date
)
{
$this
->
userId
=
$userId
;
$this
->
addressId
=
$addressId
;
$this
->
quoi
=
$quoi
;
$this
->
taille
=
$taille
;
$this
->
status
=
$status
;
$this
->
date
=
$date
;
}
public
function
getUserId
()
{
return
$this
->
userId
;
}
public
function
getAddressId
()
{
return
$this
->
addressid
;
}
public
function
getQuoi
()
{
return
$this
->
quoi
;
}
public
function
getTaille
()
{
return
$this
->
taille
;
}
public
function
getStatus
()
{
return
$this
->
status
;
}
public
function
getDateCreation
()
{
return
$this
->
date
;
}
}
src/LQDN/Container.php
View file @
fb136c4c
...
...
@@ -56,6 +56,7 @@ class Container extends BaseContainer
return
new
CommandHandler
([
new
Handler\AddressHandler
(
$c
[
'db'
]),
new
Handler\DonationHandler
(
$c
[
'db'
]),
new
Handler\CounterpartHandler
(
$c
[
'db'
]),
new
Handler\AdminHandler
(
$c
[
'db'
]),
new
Handler\UserHandler
(
$c
[
'db'
]),
]);
...
...
src/LQDN/Finder/AddressFinder.php
View file @
fb136c4c
...
...
@@ -27,4 +27,19 @@ class AddressFinder
$addresse
=
$stmt
->
fetch
();
return
$addresse
;
}
/**
* Return adresses linked to a counterpart
*
* @param mixed $counterpartId
*
* @return array
*/
public
function
findByCounterpartId
(
$counterpartId
)
{
$counterpartId
=
(
int
)
$counterpartId
;
$stmt
=
$this
->
connection
->
executeQuery
(
'SELECT * FROM adresses WHERE user_id = :user_id'
,
[
'user_id'
=>
$counterpartId
]);
$addresse
=
$stmt
->
fetch
();
return
$addresse
;
}
}
src/LQDN/Finder/DonationFinder.php
View file @
fb136c4c
...
...
@@ -53,6 +53,7 @@ SELECT d.id as id,
d.status AS status,
d.user_id AS user_id,
u.email AS email,
u.pseudo AS pseudo,
a.nom AS nom,
a.adresse AS adresse,
a.adresse2 AS adresse2,
...
...
src/LQDN/Handler/CounterpartHandler.php
0 → 100644
View file @
fb136c4c
<?php
namespace
LQDN\Handler
;
use
Doctrine\DBAL\Connection
;
use
LQDN\Command\CounterpartCreateCommand
;
use
LQDN\Command\CounterpartDeleteCommand
;
use
LQDN\Command\CounterpartUpdateCommand
;
use
LQDN\Exception\CounterpartAlreadyExistsException
;
class
CounterpartHandler
{
private
$connection
;
public
function
__construct
(
Connection
$connection
)
{
$this
->
connection
=
$connection
;
}
/**
* Delete a counterpart
*
* @param CounterpartDeleteCommand $command
*/
public
function
handleCounterpartDeleteCommand
(
CounterpartDeleteCommand
$command
)
{
$counterpartId
=
$command
->
getCounterpartId
();
$this
->
connection
->
executeUpdate
(
"DELETE FROM counterparts WHERE id = :id"
,
[
'id'
=>
$counterpartId
()]);
}
/**
* Create a counterpart
*
* @param CounterpartCreateCommand $command
*/
public
function
handleCounterpartCreateCommand
(
CounterpartCreateCommand
$command
)
{
$userId
=
$command
->
getUserId
();
$adresseId
=
$command
->
getAdressId
();
$query
=
<<<EOF
REPLACE INTO counterparts(datec, user_id, addresse_id, quoi, taille, status)
VALUES (:datec, :user_id, :addresse_id, :quoi, :taille, :status)
EOF;
$stmt
=
$this
->
connection
->
prepare
(
$query
);
$stmt
->
bindValue
(
'user_id'
,
$command
->
getUserId
());
$stmt
->
bindValue
(
'adresse_id'
,
$command
->
getAddressId
());
$stmt
->
bindValue
(
'quoi'
,
$command
->
getQuoi
());
$stmt
->
bindValue
(
'taille'
,
$command
->
getTaille
());
$stmt
->
bindValue
(
'datec'
,
$command
->
getDate
());
$stmt
->
bindValue
(
'status'
,
$command
->
getStatus
());
}
}
tests/functional/Finder/AddressFinderTest.php
View file @
fb136c4c
...
...
@@ -25,4 +25,24 @@ class AddressFinderTest extends FunctionalTest
];
$this
->
assertEquals
(
$expectedAddress
,
$addresse
);
}
public
function
testFindByCounterpartId
()
{
$addresse
=
$this
->
container
[
'address_finder'
]
->
findByCounterpartId
(
1
);
$this
->
assertCount
(
9
,
$addresse
);
// Check the address have an ID of 1
$expectedAddress
=
[
'id'
=>
'1'
,
'nom'
=>
'Main'
,
'adresse'
=>
'1 rue Ménars'
,
'adresse2'
=>
null
,
'codepostal'
=>
'75001'
,
'ville'
=>
'Paris'
,
'etat'
=>
null
,
'pays'
=>
'France'
,
'user_id'
=>
'1'
,
];
$this
->
assertEquals
(
$expectedAddress
,
$addresse
);
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment