--- /dev/null
+<?php
+
+class VersionsControllerTest extends AlloServeurTest {
+
+ /** @var VersionsController */
+ private $versionController;
+
+ private $version_id;
+
+ protected function setUp(){
+ parent::setUp();
+ $this->version_id = 1;
+ $this->versionController = new VersionsController();
+ }
+
+ public function testNbVersion(){
+ $this->versionController->setGetParametersByArray(array('product_id'=>1));
+ $this->assertEquals(2,$this->versionController->nbAction());
+ }
+
+ public function testList(){
+ $this->versionController->setGetParametersByArray(array('product_id'=>1));
+ $result = $this->versionController->listAction();
+ $this->assertEquals("1.4.4",$result[0]['value']);
+ }
+
+ public function testDelete(){
+ $this->versionController->setGetParametersByArray(array('id'=>$this->version_id));
+ $this->versionController->deleteAction();
+ $this->assertEquals(0,$this->versionController->nbAction());
+ }
+
+ public function testEdit(){
+ $this->versionController->setGetParametersByArray(
+ array('id'=>$this->version_id,'value'=>'2.0.0','product_id'=>1,'nature'=>Version::NATURE_MAJ_MAJ));
+ $this->versionController->editAction();
+ $this->versionController->setGetParameters(new GetParameters(array('id'=>$this->version_id)));
+ $result = $this->versionController->infoAction();
+ $this->assertEquals("2.0.0",$result['value']);
+ }
+
+ public function testListNatureAction(){
+ $result = $this->versionController->listNatureAction();
+ $this->assertEquals(Version::getNatureList(),$result);
+ }
+
+}
\ No newline at end of file