Skip to content
Snippets Groups Projects
Commit 1bb67fff authored by efalcy's avatar efalcy
Browse files

hotline #48190 fix Toutapprendre albums update

parent 35c18b48
Branches
Tags
4 merge requests!1837Master,!1836Hotline master,!1835Stable,!1831hotline #48190 fix Toutapprendre albums update
- ticket #48190 : Cours en ligne Toutaprendre : correction de la mise à jour des albums
\ No newline at end of file
......@@ -16,10 +16,10 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebService_BibNumerique_RessourceNumerique{
class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebService_BibNumerique_RessourceNumerique{
public function fillAlbum($album) {
$album
->beCoursToutApprendre()
......@@ -30,6 +30,14 @@ class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebSer
}
public function import() {
if (!$album = $this->findAlbumInDB())
$album = Class_Album::newInstance();
return parent::updateAlbum($album);
}
public function getRessourceCategorieLibelle() {
return 'Cours en ligne Tout Apprendre';
}
......
......@@ -49,10 +49,6 @@ class ToutApprendreTest extends Storm_Test_ModelTestCase{
'label'=> 'Tout apprendre'
]);
Class_Album::beVolatile();
Class_AlbumCategorie::beVolatile();
Class_Album::setFileSystem(Storm_Test_ObjectWrapper::mock()
->whenCalled('rmdir')
->answers(true)
......@@ -63,7 +59,6 @@ class ToutApprendreTest extends Storm_Test_ModelTestCase{
->whenCalled('getNextOrderFor')
->answers(1);
Class_AlbumRessource::beVolatile();
self::$toutApprendre = new Class_WebService_BibNumerique_ToutApprendre();
self::$toutApprendre->harvest('');
}
......@@ -71,18 +66,11 @@ class ToutApprendreTest extends Storm_Test_ModelTestCase{
public function setUp() {
parent::setUp();
Storm_Model_Loader::defaultToVolatile();
$this->_toutApprendre = self::$toutApprendre;
$this->_first_album = $this->_toutApprendre->getAlbums()[0];
}
public function tearDown() {
Storm_Model_Loader::defaultToDb();
parent::tearDown();
}
/**
* [[file:~/www/afi-opac/tests/fixtures/toutApprendre_catalogue.xml::<titre>Safari%202</titre][formation Safari2]]
* @test
......@@ -123,8 +111,6 @@ class ToutApprendreTest extends Storm_Test_ModelTestCase{
}
/** @test */
public function firstAlbumLibreOfficeDesciptionShouldBeSet() {
$this->assertEquals("Accéder aux données de LibreOffice Database et les imprimer",$this->_first_album->getDescription());
......@@ -155,6 +141,21 @@ class ToutApprendreTest extends Storm_Test_ModelTestCase{
$this->assertEquals('18;19',$this->_first_album->getSections());
}
}
?>
/** @test */
public function oldRessourceShouldHaveBeenDelete() {
RessourcesNumeriquesFixtures::activateToutApprendre();
$old_resource = $this->fixture('Class_AlbumRessource',
['id' => 56,
'titre' => 'old ressource',
'id_album' => 11,
'id_origine' => 456
]);
$this->_first_album->setResources([$old_resource])->assertSave();
$this->_toutApprendre->harvest('');
$this->assertNull(Class_AlbumRessource::find(56));
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment