Skip to content
Snippets Groups Projects
Commit 139e3245 authored by llaffont's avatar llaffont
Browse files

Affichage de l'utilisateur + bib qui a posté le formulaire

parent 69a1a68d
No related merge requests found
......@@ -6,8 +6,8 @@ $data_names = Class_Formulaire::mergeDataNames($this->formulaires);
echo $this->tagModelTable(
$this->formulaires,
$data_names,
$data_names,
array_merge([$this->_('Posté par'), $this->_('Bibliothèque')], $data_names),
array_merge(['compte', 'libelle_bib'], $data_names),
[['action' => 'delete-formulaire', 'content' => $this->boutonIco('type=del')]],
'formulaires');
?>
\ No newline at end of file
......@@ -70,4 +70,19 @@ class Class_Formulaire extends Storm_Model_Abstract {
$this->setDateCreation(date('Y-m-d H:i:s', self::getTimeSource()->time()));
}
public function getCompte() {
if ($this->hasUser())
return $this->getUser()->getNomComplet();
return '';
}
public function getLibelleBib() {
if ($user = $this->getUser())
return $user->getLibelleBib();
return '';
}
}
......@@ -40,7 +40,12 @@ abstract class ModoControllerFormulaireForArticleTestCase extends Admin_Abstract
Class_Formulaire::newInstanceWithId(5, ['data' => serialize(['nom' => 'Bougie',
'Prenom' => 'Mireille']),
'article' => $article]),
'article' => $article,
'user' => Class_Users::newInstanceWithId(34,
[
'login' => 'zork',
'bib' => Class_Bib::newInstanceWithId(4, ['libelle' => 'Annecy'])
])]),
Class_Formulaire::newInstanceWithId(6, ['data' => serialize(['name' => 'Lefort',
'prenom' => 'Nono',
......@@ -87,13 +92,25 @@ class ModoControllerFormulaireForArticleListTest extends ModoControllerFormulair
/** @test */
public function aTDShouldContainsPrenomMireille() {
$this->assertXPathContentContains('//td', 'Mireille');
$this->assertXPathContentContains('//tr[2]//td', 'Mireille');
}
/** @test */
public function mireilleRowShouldContainsUserZork() {
$this->assertXPathContentContains('//tr[2]//td', 'zork');
}
/** @test */
public function mireilleRowShouldContainsBibAnnecy () {
$this->assertXPathContentContains('//tr[2]//td', 'Annecy');
}
/** @test */
public function aTDShouldContainsActionToDeleteFormulaireMireille() {
$this->assertXPath('//td/a[contains(@href, "admin/modo/delete-formulaire/id_article/12/id/5")]');
$this->assertXPath('//tr[2]//td/a[contains(@href, "admin/modo/delete-formulaire/id_article/12/id/5")]');
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment