Skip to content
Snippets Groups Projects
Commit c598278d authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

dev #69826 remove versions

parent 6c5095ae
Branches
Tags
2 merge requests!2523Master,!2516Dev#69826 contractuel minsoc diffusion selective de l information enregistrer modifier ma recherche
Pipeline #3428 passed with stage
in 27 minutes and 2 seconds
......@@ -224,4 +224,10 @@ Il y a %s nouveau(x) résultat(s) pour votre recherche "%s" :
$previous_keys = $this->getLastVersionData([]);
return array_diff($current_keys, $previous_keys);
}
public function afterDelete() {
parent::afterDelete();
$this->clearVersions();
}
}
......@@ -66,4 +66,9 @@ trait Trait_Versionable {
? $version->getData()
: $default;
}
public function clearVersions() {
$this->versions()->clear();
}
}
......@@ -267,6 +267,9 @@ class Bookmarks_SearchDeleteBookmarkedSearchTest extends Bookmarks_SearchWithSes
public function setUp() {
parent::setUp();
$persistence = Class_Versions::getPersistence();
$persistence->atPut(5, ['test']);
$this->fixture('Class_User_BookmarkedSearch',
['id' => 5,
'id_user' => $this->_user->getId(),
......@@ -278,6 +281,12 @@ class Bookmarks_SearchDeleteBookmarkedSearchTest extends Bookmarks_SearchWithSes
}
/** @test */
public function versionsShouldBeDeleted() {
$this->assertEquals([], Class_Versions::getPersistence()->asArray());
}
/** @test */
public function milesDavisSearchShouldHabeBeenDeleted() {
$this->assertNull(Class_User_BookmarkedSearch::find(5));
......
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