Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Comptoir
Comptoir-srv
Commits
76829b8c
Commit
76829b8c
authored
May 04, 2020
by
Fabrice Gangler
🎨
Browse files
TEST(mapping): add one test for new "comment" field
Refs:
#891
parent
b10e5c10
Pipeline
#9533
passed with stage
in 3 minutes and 27 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
tests/Fixture/TaxonomysSoftwaresFixture.php
View file @
76829b8c
...
...
@@ -23,6 +23,15 @@ class TaxonomysSoftwaresFixture extends TestFixture
'user_id'
=>
[
'type'
=>
'integer'
,
'length'
=>
10
,
'default'
=>
null
,
'null'
=>
true
,
'comment'
=>
null
,
'precision'
=>
null
,
'unsigned'
=>
null
,
'autoIncrement'
=>
null
],
'created'
=>
[
'type'
=>
'timestamp'
,
'length'
=>
null
,
'default'
=>
null
,
'null'
=>
false
,
'comment'
=>
null
,
'precision'
=>
null
],
'modified'
=>
[
'type'
=>
'timestamp'
,
'length'
=>
null
,
'default'
=>
null
,
'null'
=>
false
,
'comment'
=>
null
,
'precision'
=>
null
],
'comment'
=>
[
'type'
=>
'text'
,
'length'
=>
null
,
'default'
=>
null
,
'null'
=>
true
,
'collate'
=>
null
,
'comment'
=>
null
,
'precision'
=>
null
],
'_constraints'
=>
[
'primary'
=>
[
'type'
=>
'primary'
,
'columns'
=>
[
'id'
],
'length'
=>
[]],
'taxonomys_softwares_software_id'
=>
[
'type'
=>
'foreign'
,
'columns'
=>
[
'software_id'
],
'references'
=>
[
'softwares'
,
'id'
],
'update'
=>
'cascade'
,
'delete'
=>
'cascade'
,
'length'
=>
[]],
...
...
@@ -50,7 +59,7 @@ class TaxonomysSoftwaresFixture extends TestFixture
// 'id' => 2,
'taxonomy_id'
=>
3
,
'software_id'
=>
1
,
'user_id'
=>
1
,
'user_id'
=>
4
,
'created'
=>
1581686289
,
'modified'
=>
1581686289
],
...
...
@@ -66,7 +75,7 @@ class TaxonomysSoftwaresFixture extends TestFixture
// 'id' => 4,
'taxonomy_id'
=>
5
,
'software_id'
=>
2
,
'user_id'
=>
2
,
'user_id'
=>
4
,
'created'
=>
1581686289
,
'modified'
=>
1581686289
],
...
...
@@ -92,7 +101,8 @@ class TaxonomysSoftwaresFixture extends TestFixture
'software_id'
=>
2
,
'user_id'
=>
3
,
'created'
=>
1581686289
,
'modified'
=>
1581686289
'modified'
=>
1581686289
,
'comment'
=>
'blabla bla du comentaire'
],
[
// 'id' => 8,
...
...
tests/TestCase/Controller/Api/V1/TaxonomysControllerTest.php
View file @
76829b8c
...
...
@@ -633,7 +633,8 @@ class TaxonomysControllerTest extends ApiIntegrationTestCase
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* mappingTaxonUsersOf method: a taxon has a software with users (one or more)
* mappingTaxonUsersOf method:
* a taxon has a software with users (one or more), without comment
*
* URL: /fr/cartographie/<slugPrimaryLevel>/<slugTaxon>/<slugSoftware>/<taxonId>.<softwareId>
* /en/mapping/<slugPrimaryLevel>/<slugTaxon>/<slugSoftware>/<taxonId>.<softwareId>
...
...
@@ -651,10 +652,12 @@ class TaxonomysControllerTest extends ApiIntegrationTestCase
* @group taxonomy_mappingTaxonUsersOf
* @return void
*/
public
function
testMappingTaxonUsersOfShouldHaveSoftwareWithUsers
()
public
function
testMappingTaxonUsersOfShouldHaveSoftwareWithUsers
WithoutComments
()
{
$idTaxon
=
3
;
$idSoftware
=
1
;
$idUserA
=
2
;
$idUserB
=
4
;
$url
=
"/fr/cartographie/metiers/urbanisme-espace-public-environnement/asalae/
$idTaxon
.
$idSoftware
"
;
$title
=
"<title>Utilisateurs du logiciel Asalae - Urbanisme / Espace public / Environnement"
;
...
...
@@ -667,7 +670,9 @@ class TaxonomysControllerTest extends ApiIntegrationTestCase
$this
->
assertContains
(
"
$title
"
,
"
$html
"
);
$this
->
assertContains
(
"id=
\"
mappingTaxon
$idTaxon
-UsersOf
$idSoftware
\"
"
,
$html
);
// <section id="">
$this
->
assertContains
(
"class=
\"
mappingTaxonUsersOfPage"
,
$html
);
// <section class="">
$this
->
assertContains
(
"id=
\"
userPreviewCard-
$idSoftware
\"
"
,
$html
);
$this
->
assertContains
(
"id=
\"
userPreviewCard-
$idUserA
\"
"
,
$html
);
$this
->
assertContains
(
"id=
\"
userPreviewCard-
$idUserB
\"
"
,
$html
);
$this
->
assertNotContains
(
"class=
\"
taxonomyComment
\"
"
,
$html
);
// Connected user (type != "Administration") --> to be deleted when development is complete.
$this
->
setConnectedPersonSession
();
...
...
@@ -683,6 +688,50 @@ class TaxonomysControllerTest extends ApiIntegrationTestCase
}
/**
* mappingTaxonUsersOf method:
* a taxon has a software with users (one or more), with comment (one or more)
*
* URL: /fr/cartographie/<slugPrimaryLevel>/<slugTaxon>/<slugSoftware>/<taxonId>.<softwareId>
* /en/mapping/<slugPrimaryLevel>/<slugTaxon>/<slugSoftware>/<taxonId>.<softwareId>
*
* ex: /fr/cartographie/generiques/bureautique/libreoffice/20.33
* /en/mapping/generics/office-automation/libreoffice/20.33
*
*
* @todo WIP
* @todo admin user to be replaced by a connected user (type = "Administration") when development is complete.
*
* @group public
* @group taxonomy
* @group taxonomy_public
* @group taxonomy_mappingTaxonUsersOf
* @return void
*/
public
function
testMappingTaxonUsersOfShouldHaveSoftwareWithUsersWithComments
()
{
$idTaxon
=
5
;
$idSoftware
=
2
;
$idUser
=
3
;
$url
=
"/fr/cartographie/generiques/infrastructure/lutece/
$idTaxon
.
$idSoftware
"
;
$title
=
"<title>Utilisateurs du logiciel Lutèce - Infrastructure"
;
// Admin user --> to be replaced by a connected user (type = "Administration") when development is complete.
$this
->
setAdminSessionOfAdministrationType
();
# dev version
// $this->setConnectedAdministrationSession(); # final version
$r
=
$this
->
checkUrlOk
(
$url
,
[
'html'
]);
$html
=
$r
[
'html'
][
'data'
];
$this
->
assertContains
(
'<html lang="fr">'
,
"
$html
"
);
$this
->
assertContains
(
"
$title
"
,
"
$html
"
);
$this
->
assertContains
(
"id=
\"
mappingTaxon
$idTaxon
-UsersOf
$idSoftware
\"
"
,
$html
);
// <section id="">
$this
->
assertContains
(
"class=
\"
mappingTaxonUsersOfPage"
,
$html
);
// <section class="">
$this
->
assertContains
(
"id=
\"
userPreviewCard-
$idUser
\"
"
,
$html
);
$this
->
assertContains
(
"class=
\"
taxonomyComment
\"
"
,
$html
);
$this
->
assertContains
(
"id=
\"
mappingTaxon
$idTaxon
-UsersOf
$idSoftware
-comment-user
$idUser
\"
"
,
$html
);
$this
->
assertContains
(
"blabla bla du comentaire"
,
$html
);
}
/**
* mappingTaxonUsersOf method: a taxon has a software without user (preselected software)
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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