diff --git a/application/modules/admin/controllers/TypeDocsController.php b/application/modules/admin/controllers/TypeDocsController.php index f80ea079d13cfa7213d3ef97414dec5163169bbe..c6c47b6e6c250eb8c56460a7ae6c49f1c75d9279 100644 --- a/application/modules/admin/controllers/TypeDocsController.php +++ b/application/modules/admin/controllers/TypeDocsController.php @@ -20,12 +20,16 @@ */ class Admin_TypeDocsController extends ZendAfi_Controller_Action { + use Trait_Translator; + public function getRessourceDefinitions() { return [ 'model' => ['class' => 'Class_TypeDoc', 'name' => 'type_doc', 'order' => 'libelle'], + 'messages' => ['successful_save' => $this->_('Type de document %s modifié')], + 'actions' => ['edit' => ['title' => 'Modification du type de document:'], 'index' => ['title' => 'Types de documents']], 'display_groups' => ['definition' => ['legend' => 'Définition', diff --git a/library/Class/TypeDoc.php b/library/Class/TypeDoc.php index 75330db1e56fa83028d13b4c9553fa614c4b840c..1c8723d3f174a7257080e992d7e6a5e1be2b47a1 100644 --- a/library/Class/TypeDoc.php +++ b/library/Class/TypeDoc.php @@ -262,12 +262,19 @@ class Class_TypeDoc extends Storm_Model_Abstract { } - public function getFamilleId() { return $this->getCodifTypeDoc()->getId(); } + public function getLibelle() { + return $this->getLabel(); + } + + public function setFamilleId($id) { + $this->getCodifTypeDoc()->setFamilleId($id); + } + public function toArray() { return ['id'=> $this->getId(), 'famille_id' => $this->getFamilleId()]; diff --git a/tests/application/modules/admin/controllers/TypeDocsControllerTest.php b/tests/application/modules/admin/controllers/TypeDocsControllerTest.php index 960197ef035283ecd63298bb28e5dd485398e9d4..9b141fc56c389f3b859803cdef5bb8cba07d9acf 100644 --- a/tests/application/modules/admin/controllers/TypeDocsControllerTest.php +++ b/tests/application/modules/admin/controllers/TypeDocsControllerTest.php @@ -70,6 +70,7 @@ class TypeDocsControllerIndexTest extends AbstractTypeDocsControllerTest { } + class TypeDocsControllerEditTest extends AbstractTypeDocsControllerTest { public function setUp() { @@ -82,10 +83,32 @@ class TypeDocsControllerEditTest extends AbstractTypeDocsControllerTest { $this->assertXPathContentContains('//h1','Modification du type de document',$this->_response->getBody()); } - /** @test */ public function livreShouldBeSelected() { $this->assertXPath('//form//select[@name="famille_id"]/option[@value="1"][@selected="selected"]', $this->_response->getBody()); } + + +} + + +class TypeDocsControllerEditPostTest extends AbstractTypeDocsControllerTest { + + public function setUp() { + parent::setUp(); + $this->postDispatch('/admin/type-docs/edit/id/1', ['id' => '1', + 'famille_id' => '4']); + + } + + /** @test */ + public function typeDocShouldBe4() { + $this->assertEquals(4,Class_CodifTypeDoc::find(1)->getFamilleId()); + } + + + + } + ?> \ No newline at end of file