--- /dev/null
+<?php
+
+class AnonymousControllerTest extends AlloServeurTest {
+
+ /** @var AnonymousController */
+ private $anonymousController;
+
+ protected function setUp() {
+ parent::setUp();
+ $this->anonymousController = new AnonymousController();
+ }
+
+ public function testGetInfoByUUIDActionError(){
+ $this->anonymousController->setGetParametersByArray(array('uuid'=>'12'));
+ $this->setExpectedException("Exception","Instance inconnue");
+ $this->anonymousController->getInfoByUUIDAction();
+ }
+
+ public function testGetInfoByUUIDAction(){
+ $this->anonymousController->setGetParametersByArray(array('uuid'=>'2ee8ab35-2a2d-450a-9fc3-71e06fc0491d'));
+ $info = $this->anonymousController->getInfoByUUIDAction();
+ $this->assertEquals('PA/VILLEBEAU_30032_20160318082426',$info['reference']['value']);
+ }
+
+ public function testProductExistsByNameAction(){
+ $this->anonymousController->setGetParametersByArray(array('name'=>'Pastell'));
+ $this->assertTrue($this->anonymousController->productExistsByNameAction());
+ }
+
+ public function testversionExistsByValueAction(){
+ $this->anonymousController->setGetParametersByArray(
+ array(
+ 'product_name' => 'Pastell',
+ 'version_value' => '1.4.4')
+ );
+ $this->assertTrue($this->anonymousController->versionExistsByValueAction());
+ }
+
+ public function testPatchExistsAction(){
+ $this->anonymousController->setGetParametersByArray(
+ array(
+ 'uuid' => '2ee8ab35-2a2d-450a-9fc3-71e06fc0491d'
+ )
+ );
+ $info = $this->anonymousController->patchExistsAction();
+ $this->assertEquals("1.4.5",$info['value']);
+ $this->assertEquals("echo toto",$info['script_content']);
+ }
+
+}
\ No newline at end of file