Skip to content

Theme reader #20#21

Merged
unflores merged 11 commits intomainfrom
theme-reader
Apr 2, 2025
Merged

Theme reader #20#21
unflores merged 11 commits intomainfrom
theme-reader

Conversation

@magrigsdev
Copy link
Collaborator

Modify ExtractService to accept a $sheet of type Worksheet in its constructor.
Remove the $excel_file parameter from the GetThemesFromExcelFile method.
Verify that the make imports/import-themes command runs without errors.

Copy link
Owner

@unflores unflores left a comment

Choose a reason for hiding this comment

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

Il faut revoir les besoins. Dis-moi si tu veux en parler.

Comment on lines +55 to +56
if ($extract_service->checkThemesIsAlreadySaved($extracted_themes)) {
$io->info('All themes already exist in the database');
Copy link
Owner

Choose a reason for hiding this comment

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

je ne pense pas qu'il soit une bonne idée de faire ce check comme extract service va create et update les themes.

) {
}

public function extract(): array
Copy link
Owner

Choose a reason for hiding this comment

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

Maintenant tu peux tester extract meme sans ton fichier originel: https://github.com/unflores/di_example/blob/main/src/test/ThemeReaderTest.php#L22-L27

$themes = $ExtractServices->GetThemesFromExcelFile($excel_file);
$preparedThemes = $ExtractServices->PrepareThemesForDatabase($themes);
$savedThemesCount = $ExtractServices->SaveThemesOnDatabase($preparedThemes);
$read_themes = new ThemeReader($this->sheet);
Copy link
Owner

Choose a reason for hiding this comment

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

Tu ne dois pas melanger les tests. Normalment tu testerait theme reader seul, extract service seul et tu auras un test d'integration pour les deux. Ce que j'avais en tete etait plutot: https://github.com/unflores/di_example/blob/main/src/test/ThemeReaderTest.php#L22-L32

Typiquement ce dont je parle s'appelle un test unitaire, parce qu'il y a un seul unit(ou module) de code testé. Brèf, tu pourrais le changer plutard si tu as envie mais pour l'instant on peut avancer je pense...

@unflores unflores merged commit 9e016dd into main Apr 2, 2025
1 check passed
@unflores unflores deleted the theme-reader branch April 2, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants