Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return false on AppConfigUnknownKeyException #43275

Conversation

ArtificialOwl
Copy link
Member

there is no logic in the current behavior of updateLazy() and updateSensitive that throw an AppConfigUnknownKeyException.

if there is no key in the database, there is no migration and we returns false

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
@ArtificialOwl ArtificialOwl force-pushed the enh/noid/no-exception-on-missing-key-updatelazy-updatesensitie branch from e4b8fc1 to 1b2e503 Compare February 1, 2024 22:52
@ArtificialOwl ArtificialOwl added the 3. to review Waiting for reviews label Feb 2, 2024
@ArtificialOwl ArtificialOwl added this to the Nextcloud 29 milestone Feb 2, 2024
@ArtificialOwl ArtificialOwl requested review from a team, nickvergessen, icewind1991, blizzz, Altahrim, artonge and come-nc and removed request for a team February 2, 2024 08:28
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add unit test 🙊

@ArtificialOwl ArtificialOwl merged commit f910baf into master Feb 5, 2024
134 checks passed
@ArtificialOwl ArtificialOwl deleted the enh/noid/no-exception-on-missing-key-updatelazy-updatesensitie branch February 5, 2024 17:21
@ArtificialOwl
Copy link
Member Author

ArtificialOwl commented Feb 6, 2024

Add unit test 🙊

public function testUpdateLazyToLazyReturnsFalse(): void {
$config = $this->generateAppConfig();
$this->assertSame(false, $config->updateLazy('non-sensitive-app', 'lazy-key', true));
}
public function testUpdateNotLazyToNotLazyReturnsFalse(): void {
$config = $this->generateAppConfig();
$this->assertSame(false, $config->updateLazy('non-sensitive-app', 'non-lazy-key', false));
}
public function testUpdateLazyOnUnknownKeyReturnsFalse(): void {
$config = $this->generateAppConfig();
$this->assertSame(false, $config->updateLazy('non-sensitive-app', 'unknown-key', true));
}

Added in #43370

@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants