prestaconcept / PrestaSitemapBundle

A symfony bundle that provides tools to build a rich application sitemap. The main goals are : simple, no databases, various namespace (eg. google image), respect constraints etc.
MIT License
347 stars 100 forks source link

Always cleanup tmp dir on sitemap dump [cherry pick 1.x] #261

Closed yann-eugone closed 3 years ago

yann-eugone commented 3 years ago

This commit is a cherry pick of edce3f7e2fcb0fca7bbacd3266a468d00c7ca1ae


As suspected in #258 Dumper service may not call cleanup if an exception is thrown during dump.

This wrap (almost) the whole dump function with a try / finally so cleanup is always called.

After adding the assertTempFilesWereRemoved in DumperTest, some tests were already failing (testExistingInvalidSitemap). I still decided to add a dedicated test case to handle a throwing exception listener.