diff --git a/library/Class/CodifAuteur.php b/library/Class/CodifAuteur.php index 829e0fe3ee478f4ea94dffee8a68309fffff0151..3fbf4c569a8cbdff98a374f7709caa12dad13998 100644 --- a/library/Class/CodifAuteur.php +++ b/library/Class/CodifAuteur.php @@ -23,7 +23,7 @@ class Class_CodifAuteur extends Storm_Model_Abstract { protected $_table_name = 'codif_auteur'; protected $_table_primary = 'id_auteur'; - public static function findOrCreate($code_alpha) { + public static function findOrCreate($code_alpha,$auteur) { $existing = Class_CodifAuteur::findFirstBy( ['where' => 'MATCH(formes) AGAINST(\'"'. $code_alpha . '"\' IN BOOLEAN MODE)']); diff --git a/library/Class/Indexation/PseudoNotice/FacettesVisitor.php b/library/Class/Indexation/PseudoNotice/FacettesVisitor.php index 06595a6560cf0bd8ea1257e1a98aeddb9510f644..d1809d0a6ad6de931dfdd2bbbbd61fd84ea106e2 100644 --- a/library/Class/Indexation/PseudoNotice/FacettesVisitor.php +++ b/library/Class/Indexation/PseudoNotice/FacettesVisitor.php @@ -76,7 +76,7 @@ class Class_Indexation_PseudoNotice_FacettesVisitor extends Class_Indexation_Pse if (!$code_alpha = str_replace(' ', 'x', $this->_indexation->alphaMaj($auteur))) return $this; - $this->_facettes []= 'A' . Class_CodifAuteur::findOrCreate($code_alpha)->getId(); + $this->_facettes []= 'A' . Class_CodifAuteur::findOrCreate($code_alpha,$auteur)->getId(); return $this; } diff --git a/tests/application/modules/admin/controllers/AlbumControllerPharoVideosTest.php b/tests/application/modules/admin/controllers/AlbumControllerPharoVideosTest.php index a2539ff97ee5a5ff2cadafd609af4ba31197b726..9018c8c04f718418acc49e9f72f9250f35b993e6 100644 --- a/tests/application/modules/admin/controllers/AlbumControllerPharoVideosTest.php +++ b/tests/application/modules/admin/controllers/AlbumControllerPharoVideosTest.php @@ -29,7 +29,7 @@ abstract class Admin_AlbumControllerPharoVideosTestCase extends Admin_AbstractCo 'libelle' => 'Languages de prog.']) ]); Class_AlbumRessource::beVolatile(); - + } } diff --git a/tests/application/modules/admin/controllers/AlbumControllerTest.php b/tests/application/modules/admin/controllers/AlbumControllerTest.php index 2de704d743cc3fd1a826e8deaf0d0d1f50064985..f726834e681802af90062a364f3630d1465f7bf5 100644 --- a/tests/application/modules/admin/controllers/AlbumControllerTest.php +++ b/tests/application/modules/admin/controllers/AlbumControllerTest.php @@ -1131,7 +1131,7 @@ class Admin_AlbumControllerPostEditAlbumMesBDTest extends Admin_AlbumControllerT ->answers(true); Storm_Cache::setDefaultZendCache($this->cache_mock); - + Class_CodifAuteur::beVolatile(); $this->postDispatch('/admin/album/edit_album/id/43', ['titre' => 'Mes BD', 'description' => "Les préférées de l'année", @@ -1167,12 +1167,19 @@ class Admin_AlbumControllerPostEditAlbumMesBDTest extends Admin_AlbumControllerT } + /** @test */ function auteurShouldBePat() { $this->assertEquals('Pat', $this->bd->getAuteur()); } + /** @test */ + function auteurPatShouldBeHaveBeenCreatedOnTheFly() { + $this->assertEquals('Pat', Class_CodifAuteur::findFirstBy(['libelle'=>'Pat'])->getLibelle()); + } + + /** @test */ function anneeShouldBe1998() { $this->assertSame('1998', $this->bd->getAnnee()); @@ -2170,7 +2177,7 @@ abstract class ControllerAlbumMultiMediasTestCase extends AbstractControllerTest ->with(['cat_id'=>'33']) ->answers([$album]); - + } }