From 8b0414c8020508886fd61d5466793e074da1e722 Mon Sep 17 00:00:00 2001
From: gloas <gloas@git-test.afi-sa.fr>
Date: Wed, 10 Apr 2013 16:27:45 +0000
Subject: [PATCH] Ajout du type doc aux albums Vodeclic

---
 library/Class/Album.php                               | 3 +++
 library/Class/TypeDoc.php                             | 3 ++-
 library/Class/WebService/Vodeclic/CatalogueParser.php | 1 +
 tests/library/Class/WebService/VodeclicTest.php       | 6 ++++++
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/library/Class/Album.php b/library/Class/Album.php
index 61f5730b81f..9214d19474e 100644
--- a/library/Class/Album.php
+++ b/library/Class/Album.php
@@ -375,6 +375,9 @@ class Class_Album extends Storm_Model_Abstract {
 		return $this->setTypeDocId(Class_TypeDoc::ARTEVOD);
 	}
 
+	public function beFormationVodeclic() {
+		return $this->setTypeDocId(Class_TypeDoc::VODECLIC);
+	}
 
 	public function isArteVOD() {
 		return $this->getTypeDocId() == Class_TypeDoc::ARTEVOD;
diff --git a/library/Class/TypeDoc.php b/library/Class/TypeDoc.php
index a82c7efaa0e..c7b5483220b 100644
--- a/library/Class/TypeDoc.php
+++ b/library/Class/TypeDoc.php
@@ -158,13 +158,14 @@ class Class_TypeDoc extends Storm_Model_Abstract {
 	const EPUB = 102;
 	const OAI = 103;
 	const ARTEVOD = 104;
+	const VODECLIC = 105;
 
 	public static function getDefaultTypeDocs() {
 		return [self::LIVRE_NUM => 'Livres numérisés',
 			      self::DIAPORAMA => 'Diaporamas',
 						self::EPUB => 'E-Books',
 						self::OAI => 'OAI',
-			      self::ARTEVOD => 'Arte VOD'];
+			      self::ARTEVOD => 'Arte VOD',self::VODECLIC => 'Formation Vodeclic'];
 	}
 
 
diff --git a/library/Class/WebService/Vodeclic/CatalogueParser.php b/library/Class/WebService/Vodeclic/CatalogueParser.php
index b3416fc3a38..e11f67c6593 100644
--- a/library/Class/WebService/Vodeclic/CatalogueParser.php
+++ b/library/Class/WebService/Vodeclic/CatalogueParser.php
@@ -38,6 +38,7 @@ class Class_WebService_Vodeclic_CatalogueParser {
 
 	public function startFormation($attributes) {
 		$this->_current_album = new Class_Album();
+		$this->_current_album->beFormationVodeclic();
 		$this->_albums[]= $this->_current_album;
 	}
 
diff --git a/tests/library/Class/WebService/VodeclicTest.php b/tests/library/Class/WebService/VodeclicTest.php
index c8ef76a2aa4..bd6bb8c6316 100644
--- a/tests/library/Class/WebService/VodeclicTest.php
+++ b/tests/library/Class/WebService/VodeclicTest.php
@@ -91,6 +91,12 @@ class VodeclicTest extends Storm_Test_ModelTestCase{
 	public function firstAlbumSafari2AnneeShouldBe2007 (){
 		$this->assertEquals('2007',$this->_first_album->getAnnee());
 	}	
+
+	/** @test */
+	public function firstAlbumSafari2TypeDocShouldBeFormationVodeclic() {
+		$this->assertEquals('Formation Vodeclic',$this->_first_album->getTypeDoc()->getLabel());
+	}
+
 }
 
 ?>
\ No newline at end of file
-- 
GitLab