@@ -413,9 +413,11 @@ public function test_delete_data_for_all_users_in_context(): void {
413413 $ this ->assertEquals (data_wiper::ANONYMIZE_STRING , $ dbrecord2 ->prompttext );
414414 $ this ->assertEquals (data_wiper::ANONYMIZE_STRING , $ dbrecord2 ->promptcompletion );
415415
416- // Verify persona1 and its selection in the deleted context are gone.
417- $ this ->assertFalse ($ DB ->record_exists ('block_ai_chat_personas ' , ['id ' => $ persona1id ]));
416+ // Verify the selection of persona1 in the deleted context is gone.
418417 $ this ->assertFalse ($ DB ->record_exists ('block_ai_chat_personas_selected ' , ['id ' => $ selection1id ]));
418+ // Verify the persona still exists, because it is not data in this context but belongs to the user and could still
419+ // be used in different contexts.
420+ $ this ->assertTrue ($ DB ->record_exists ('block_ai_chat_personas ' , ['id ' => $ persona1id ]));
419421
420422 // Verify persona2 and its selection in other context are still there.
421423 $ this ->assertTrue ($ DB ->record_exists ('block_ai_chat_personas ' , ['id ' => $ persona2id ]));
@@ -530,12 +532,14 @@ public function test_delete_data_for_users(): void {
530532 $ this ->assertEquals ('User 3 prompt ' , $ dbrecord3 ->prompttext );
531533 $ this ->assertEquals ('User 3 completion ' , $ dbrecord3 ->promptcompletion );
532534
533- // Verify user1's persona and its selection are deleted.
534- $ this ->assertFalse ($ DB ->record_exists ('block_ai_chat_personas ' , ['id ' => $ persona1id ]));
535+ // Verify the selection of user1's persona is deleted.
535536 $ this ->assertFalse ($ DB ->record_exists ('block_ai_chat_personas_selected ' , ['id ' => $ selection1id ]));
537+ // Verify the persona still exists, because it is not data in this context but belongs to the user and could still
538+ // be used in different contexts.
539+ $ this ->assertTrue ($ DB ->record_exists ('block_ai_chat_personas ' , ['id ' => $ persona1id ]));
536540
537- // Verify user2's persona is deleted .
538- $ this ->assertFalse ($ DB ->record_exists ('block_ai_chat_personas ' , ['id ' => $ persona2id ]));
541+ // Verify user2's persona also still exists .
542+ $ this ->assertTrue ($ DB ->record_exists ('block_ai_chat_personas ' , ['id ' => $ persona2id ]));
539543
540544 // Verify user3's persona is not affected.
541545 $ this ->assertTrue ($ DB ->record_exists ('block_ai_chat_personas ' , ['id ' => $ persona3id ]));
0 commit comments