diff --git a/library/Class/Import/Typo3.php b/library/Class/Import/Typo3.php index 09af94acbed40ce327fceabc55e8b70497945fd9..d6ba07d500817f717fc4caeedcc693d71754d73a 100644 --- a/library/Class/Import/Typo3.php +++ b/library/Class/Import/Typo3.php @@ -185,7 +185,7 @@ class Class_Import_Typo3 { } - protected function addImage($typo_data,$body) { + protected function addImage($typo_data) { if (!isset($typo_data['image'])) return ''; return '<img src="'.self::BOKEH_IMG_URL.'pics/'.$typo_data['image'].'" alt=""/>'; @@ -322,8 +322,8 @@ class Class_Import_Typo3 { 'debut' => $debut, 'fin' => $new['hidden'] ? null : $fin, 'id_user' => $this->userMap->find($new['cruser_id']), - 'description' => $new['short'], - 'contenu' => $new['bodytext'] ? $this->addImage($new,$new['bodytext']).$this->manipulate_body($new['bodytext']) : ' ', + 'description' => $new['short']? $this->addImage($new).$this->manipulate_body($new['short']): '', + 'contenu' => $new['bodytext'] ? $this->addImage($new).$this->manipulate_body($new['bodytext']) : ' ', 'id_cat' => $id_cat, 'status' => Class_Article::STATUS_VALIDATED, 'tags' => str_replace(', ', ';', $new['tx_danpextendnews_tags']), diff --git a/tests/library/Class/Import/Typo3Fixture.php b/tests/library/Class/Import/Typo3Fixture.php index d83c42b427bad461be2181d9a7ff93f1c3cc35cd..50433a60c22e37941ed17332fbd896446c72d386 100644 --- a/tests/library/Class/Import/Typo3Fixture.php +++ b/tests/library/Class/Import/Typo3Fixture.php @@ -143,7 +143,7 @@ class MockTypo3DB { 'starttime' => 1415110980, 'endtime' => 1422973380, 'hidden' => 0, - 'short' => null, + 'short' => 'A bord.', 'category' => 10, 'image' => 'bateau.jpg', 'tx_danpextendnews_tags' => 'pirate, bateau', diff --git a/tests/library/Class/Import/Typo3Test.php b/tests/library/Class/Import/Typo3Test.php index 825c9be3a60ba1daed463cdc5fd23ab4bb9bf260..b95c0bc542d6ab5e7dd7106a850f135897a52310 100644 --- a/tests/library/Class/Import/Typo3Test.php +++ b/tests/library/Class/Import/Typo3Test.php @@ -233,6 +233,12 @@ class Import_Typo3ArticleTest extends Import_Typo3TestCase { $this->assertContains('<img src="'.Class_Import_Typo3::BOKEH_IMG_URL.'pics/bateau.jpg" alt=""/>',$this->bateau_pirate->getContenu()); } + /** @test */ + public function articleABordDuBateauPirateShouldContainsImageWithBateauInSummary() { + $this->assertContains('<img src="'.Class_Import_Typo3::BOKEH_IMG_URL.'pics/bateau.jpg" alt=""/>',$this->bateau_pirate->getDescription()); + } + + /** @test */ public function articleABordDuBateauPirateShouldConvertImageWithUploads() { $this->assertContains('<img style="padding-right: 10px; padding-bottom: 10px; float: left;" src="'.Class_Import_Typo3::BOKEH_IMG_URL.'RTEmagicC_5_37.jpg.jpg" height="76" width="133" alt="" />',$this->bateau_pirate->getContenu());