diff --git a/.phpunit.result.cache b/.phpunit.result.cache index 1d17c8a..228c629 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -1 +1 @@ -{"version":1,"defects":{"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveCreatesNewArticle":3,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveUpdatesExistingArticle":3,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveTranslationsInsertsForNewArticle":4,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveTranslationsUpsertsForExistingArticle":4,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSavePagesForNewArticle":4,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveDeletesMarkedImagesOnUpdate":4},"times":{"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetQuantityReturnsCorrectValue":0.001,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetQuantityReturnsNullWhenProductNotFound":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testFindReturnsProductData":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testUpdateQuantitySuccess":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetPriceReturnsRegularPrice":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetPriceReturnsPromoPrice":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetPriceReturnsRegularWhenPromoIsHigher":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetPriceReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetNameReturnsProductName":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetNameReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetQuantityReturnsInteger":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testUnarchiveUpdatesProductAndChildren":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testArchiveUpdatesProductAndChildren":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testUnarchiveReturnsBool":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testArchiveReturnsBool":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testHasListMethod":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testHasUnarchiveMethod":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testListMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testUnarchiveMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testConstructorRequiresProductRepository":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testFindReturnsBannerWithTranslations":0.001,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testFindReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testDeleteReturnsTrue":0.002,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testSaveInsertsNewBanner":0,"Tests\\Unit\\Domain\\Cache\\CacheRepositoryTest::testClearCacheWithRedis":0.001,"Tests\\Unit\\Domain\\Cache\\CacheRepositoryTest::testClearCacheRedisUnavailable":0,"Tests\\Unit\\Domain\\Cache\\CacheRepositoryTest::testClearCacheWithoutRedis":0,"Tests\\Unit\\Domain\\Cache\\CacheRepositoryTest::testClearCacheReturnStructure":0,"Tests\\Unit\\Domain\\Settings\\SettingsRepositoryTest::testCanBeInstantiated":0,"Tests\\Unit\\Domain\\Settings\\SettingsRepositoryTest::testHasSaveSettingsMethod":0,"Tests\\Unit\\Domain\\Settings\\SettingsRepositoryTest::testHasGetSettingsMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testHasClearCacheMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testHasClearCacheAjaxMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testHasSaveMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testHasViewMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testIsNotAbstract":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testCanCreateController":0.002,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasListMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testListMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasEditMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testEditMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testConstructorAcceptsRepository":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testConstructorRequiresArticleRepository":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testFindReturnsArticleWithRelations":0.004,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testFindReturnsNullWhenArticleDoesNotExist":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testDeleteNonassignedFilesDeletesDbRows":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testDeleteNonassignedImagesDeletesDbRows":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveCreatesNewArticle":0.001,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveReturnsZeroWhenInsertFails":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveUpdatesExistingArticle":0.001,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveTranslationsInsertsForNewArticle":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveTranslationsUpsertsForExistingArticle":0.001,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSavePagesForNewArticle":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveDeletesMarkedImagesOnUpdate":0.001,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testArchiveSetsStatusToMinusOne":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testArchiveReturnsFalseWhenUpdateFails":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveGalleryOrderUpdatesImageOrder":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveGalleryOrderSkipsEmptyValues":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasBrowseListMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasGalleryOrderSaveMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testBrowseListMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testGalleryOrderSaveMethodReturnType":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testListForAdminWhitelistsSortAndDirection":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testListForAdminUsesBoundParamsForTitleFilter":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testSaveWithLegacyFormat":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testSaveUpdatesExistingTranslationsByBannerAndLang":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testListForAdminIncludesThumbnailSrc":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testRestoreSetsStatusToZero":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testDeletePermanentlyRemovesArticleAndRelations":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testListArchivedForAdminWhitelistsSortAndDirection":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testFindReturnsUnitWithTranslations":0.001,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testFindReturnsNullWhenUnitNotFound":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testSaveInsertsNewUnitAndTranslationsForStringLanguageId":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testDeleteRemovesUnitAndTranslations":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testGetUnitNameByIdReturnsTextFromDatabase":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testGetUnitNameByIdSupportsStringLanguageId":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testAllUnitsReturnsArrayIndexedById":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testLanguageDetailsReturnsArrayOrNull":0.001,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testLanguagesListReturnsArray":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testSaveLanguageRejectsInvalidLanguageId":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testSaveTranslationInsertsNewTranslationAndReturnsId":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testDeleteTranslationReturnsBoolean":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testListForAdminReturnsItemsAndTotal":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testDefaultLanguageIdReturnsLanguageWithStartFlag":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testDefaultLanguageIdFallsBackToFirstLanguageOrPl":0,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testFindReturnsLayoutWithRelations":0.001,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testDeleteReturnsFalseWhenOnlyOneLayoutExists":0,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testFindReturnsDefaultLayoutWhenRecordDoesNotExist":0,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testSaveInsertsNewLayoutAndReturnsId":0,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testListAllReturnsArray":0,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testTemplateDetailsReturnsNullForInvalidId":0.002,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testTemplateDetailsReturnsArray":0,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testSaveSettingsUpdatesHeaderAndFooter":0,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testDeleteTemplateReturnsFalseForAdminTemplate":0,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testTemplateByNameReturnsText":0,"Tests\\Unit\\Domain\\Scontainers\\ScontainersRepositoryTest::testFindReturnsDefaultContainerForInvalidId":0.001,"Tests\\Unit\\Domain\\Scontainers\\ScontainersRepositoryTest::testDeleteReturnsFalseForInvalidId":0,"Tests\\Unit\\Domain\\Scontainers\\ScontainersRepositoryTest::testFindReturnsContainerWithTranslations":0,"Tests\\Unit\\Domain\\Scontainers\\ScontainersRepositoryTest::testDetailsForLanguageReturnsNullForInvalidData":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testFindReturnsUserWhenExists":0.001,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testFindReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testCheckLoginReturnsErrorWhenLoginIsTaken":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testCheckLoginReturnsOkWhenAvailable":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveReturnsErrorForTooShortPasswordOnCreate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveReturnsErrorForMismatchedPasswordsOnCreate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveCreatesUserWithNormalizedSwitches":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveUpdatesExistingUserWithPassword":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveUpdatesExistingUserWithoutPassword":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveReturnsErrorForTooShortPasswordOnUpdate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveReturnsErrorForMismatchedPasswordsOnUpdate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testDeleteReturnsTrue":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testDeleteReturnsFalseOnFailure":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testDetailsReturnsUserByLogin":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testDetailsReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testLogonReturnsSuccessForValidCredentials":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testLogonReturnsZeroForNonexistentUser":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testLogonReturnsNegativeOneForBlockedUser":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testVerifyTwofaCodeReturnsFalseForNonexistentUser":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testVerifyTwofaCodeReturnsFalseAfterMaxAttempts":0.078,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testVerifyTwofaCodeReturnsFalseForExpiredCode":0.079,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testVerifyTwofaCodeReturnsTrueForValidCode":0.158,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSendTwofaCodeReturnsFalseWhen2FADisabled":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSendTwofaCodeReturnsFalseForInvalidEmail":0.001,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testUpdateByIdCallsDbUpdate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testListForAdminReturnsItemsAndTotal":0,"Tests\\Unit\\admin\\Controllers\\ArticlesArchiveControllerTest::testConstructorAcceptsRepository":0.002,"Tests\\Unit\\admin\\Controllers\\ArticlesArchiveControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\ArticlesArchiveControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\ArticlesArchiveControllerTest::testConstructorRequiresArticleRepository":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testConstructorAcceptsRepository":0.002,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testHasListMethod":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testHasEditMethod":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testHasSaveMethod":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testHasDeleteMethod":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testConstructorRequiresDictionariesRepository":0,"Tests\\Unit\\admin\\Controllers\\LanguagesControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\LanguagesControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\LanguagesControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\LanguagesControllerTest::testConstructorRequiresLanguagesRepository":0,"Tests\\Unit\\admin\\Controllers\\LayoutsControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\LayoutsControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\LayoutsControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\LayoutsControllerTest::testConstructorRequiresLayoutsRepository":0,"Tests\\Unit\\admin\\Controllers\\NewsletterControllerTest::testConstructorAcceptsDependencies":0.003,"Tests\\Unit\\admin\\Controllers\\NewsletterControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\NewsletterControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\NewsletterControllerTest::testConstructorRequiresRepositoryAndRenderer":0,"Tests\\Unit\\admin\\Controllers\\ScontainersControllerTest::testConstructorAcceptsDependencies":0.001,"Tests\\Unit\\admin\\Controllers\\ScontainersControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\ScontainersControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\ScontainersControllerTest::testConstructorRequiresRepositoryAndLanguagesRepository":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testConstructorAcceptsRepository":0.002,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasViewListMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasUserEditMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasUserSaveMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasUserDeleteMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasTwofaMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasLoginFormMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testConstructorRequiresUserRepository":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testNormalizeUserReturnsDefaultsForNull":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testNormalizeUserCastsTypes":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testNormalizeUserHandlesPartialData":0}} \ No newline at end of file +{"version":1,"defects":{"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveCreatesNewArticle":3,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveUpdatesExistingArticle":3,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveTranslationsInsertsForNewArticle":4,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveTranslationsUpsertsForExistingArticle":4,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSavePagesForNewArticle":4,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveDeletesMarkedImagesOnUpdate":4},"times":{"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetQuantityReturnsCorrectValue":0.001,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetQuantityReturnsNullWhenProductNotFound":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testFindReturnsProductData":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testUpdateQuantitySuccess":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetPriceReturnsRegularPrice":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetPriceReturnsPromoPrice":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetPriceReturnsRegularWhenPromoIsHigher":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetPriceReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetNameReturnsProductName":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetNameReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testGetQuantityReturnsInteger":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testUnarchiveUpdatesProductAndChildren":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testArchiveUpdatesProductAndChildren":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testUnarchiveReturnsBool":0,"Tests\\Unit\\Domain\\Product\\ProductRepositoryTest::testArchiveReturnsBool":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testHasListMethod":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testHasUnarchiveMethod":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testListMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testUnarchiveMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ProductArchiveControllerTest::testConstructorRequiresProductRepository":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testFindReturnsBannerWithTranslations":0.002,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testFindReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testDeleteReturnsTrue":0.001,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testSaveInsertsNewBanner":0,"Tests\\Unit\\Domain\\Cache\\CacheRepositoryTest::testClearCacheWithRedis":0.001,"Tests\\Unit\\Domain\\Cache\\CacheRepositoryTest::testClearCacheRedisUnavailable":0,"Tests\\Unit\\Domain\\Cache\\CacheRepositoryTest::testClearCacheWithoutRedis":0,"Tests\\Unit\\Domain\\Cache\\CacheRepositoryTest::testClearCacheReturnStructure":0,"Tests\\Unit\\Domain\\Settings\\SettingsRepositoryTest::testCanBeInstantiated":0,"Tests\\Unit\\Domain\\Settings\\SettingsRepositoryTest::testHasSaveSettingsMethod":0,"Tests\\Unit\\Domain\\Settings\\SettingsRepositoryTest::testHasGetSettingsMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testHasClearCacheMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testHasClearCacheAjaxMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testHasSaveMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testHasViewMethod":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testIsNotAbstract":0,"Tests\\Unit\\admin\\Controllers\\SettingsControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testCanCreateController":0.004,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasListMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testListMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasEditMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testEditMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testConstructorAcceptsRepository":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testConstructorRequiresArticleRepository":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testFindReturnsArticleWithRelations":0.004,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testFindReturnsNullWhenArticleDoesNotExist":0.001,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testDeleteNonassignedFilesDeletesDbRows":0.001,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testDeleteNonassignedImagesDeletesDbRows":0.001,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveCreatesNewArticle":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveReturnsZeroWhenInsertFails":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveUpdatesExistingArticle":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveTranslationsInsertsForNewArticle":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveTranslationsUpsertsForExistingArticle":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSavePagesForNewArticle":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveDeletesMarkedImagesOnUpdate":0.001,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testArchiveSetsStatusToMinusOne":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testArchiveReturnsFalseWhenUpdateFails":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveGalleryOrderUpdatesImageOrder":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveGalleryOrderSkipsEmptyValues":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasBrowseListMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasGalleryOrderSaveMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testBrowseListMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testGalleryOrderSaveMethodReturnType":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testListForAdminWhitelistsSortAndDirection":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testListForAdminUsesBoundParamsForTitleFilter":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testSaveWithLegacyFormat":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testSaveUpdatesExistingTranslationsByBannerAndLang":0,"Tests\\Unit\\Domain\\Banner\\BannerRepositoryTest::testListForAdminIncludesThumbnailSrc":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testRestoreSetsStatusToZero":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testDeletePermanentlyRemovesArticleAndRelations":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testListArchivedForAdminWhitelistsSortAndDirection":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testFindReturnsUnitWithTranslations":0.001,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testFindReturnsNullWhenUnitNotFound":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testSaveInsertsNewUnitAndTranslationsForStringLanguageId":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testDeleteRemovesUnitAndTranslations":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testGetUnitNameByIdReturnsTextFromDatabase":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testGetUnitNameByIdSupportsStringLanguageId":0,"Tests\\Unit\\Domain\\Dictionaries\\DictionariesRepositoryTest::testAllUnitsReturnsArrayIndexedById":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testLanguageDetailsReturnsArrayOrNull":0.001,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testLanguagesListReturnsArray":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testSaveLanguageRejectsInvalidLanguageId":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testSaveTranslationInsertsNewTranslationAndReturnsId":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testDeleteTranslationReturnsBoolean":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testListForAdminReturnsItemsAndTotal":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testDefaultLanguageIdReturnsLanguageWithStartFlag":0,"Tests\\Unit\\Domain\\Languages\\LanguagesRepositoryTest::testDefaultLanguageIdFallsBackToFirstLanguageOrPl":0,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testFindReturnsLayoutWithRelations":0.001,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testDeleteReturnsFalseWhenOnlyOneLayoutExists":0,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testFindReturnsDefaultLayoutWhenRecordDoesNotExist":0,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testSaveInsertsNewLayoutAndReturnsId":0,"Tests\\Unit\\Domain\\Layouts\\LayoutsRepositoryTest::testListAllReturnsArray":0,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testTemplateDetailsReturnsNullForInvalidId":0.002,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testTemplateDetailsReturnsArray":0,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testSaveSettingsUpdatesHeaderAndFooter":0,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testDeleteTemplateReturnsFalseForAdminTemplate":0,"Tests\\Unit\\Domain\\Newsletter\\NewsletterRepositoryTest::testTemplateByNameReturnsText":0,"Tests\\Unit\\Domain\\Scontainers\\ScontainersRepositoryTest::testFindReturnsDefaultContainerForInvalidId":0.001,"Tests\\Unit\\Domain\\Scontainers\\ScontainersRepositoryTest::testDeleteReturnsFalseForInvalidId":0,"Tests\\Unit\\Domain\\Scontainers\\ScontainersRepositoryTest::testFindReturnsContainerWithTranslations":0,"Tests\\Unit\\Domain\\Scontainers\\ScontainersRepositoryTest::testDetailsForLanguageReturnsNullForInvalidData":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testFindReturnsUserWhenExists":0.001,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testFindReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testCheckLoginReturnsErrorWhenLoginIsTaken":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testCheckLoginReturnsOkWhenAvailable":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveReturnsErrorForTooShortPasswordOnCreate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveReturnsErrorForMismatchedPasswordsOnCreate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveCreatesUserWithNormalizedSwitches":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveUpdatesExistingUserWithPassword":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveUpdatesExistingUserWithoutPassword":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveReturnsErrorForTooShortPasswordOnUpdate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSaveReturnsErrorForMismatchedPasswordsOnUpdate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testDeleteReturnsTrue":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testDeleteReturnsFalseOnFailure":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testDetailsReturnsUserByLogin":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testDetailsReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testLogonReturnsSuccessForValidCredentials":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testLogonReturnsZeroForNonexistentUser":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testLogonReturnsNegativeOneForBlockedUser":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testVerifyTwofaCodeReturnsFalseForNonexistentUser":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testVerifyTwofaCodeReturnsFalseAfterMaxAttempts":0.08,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testVerifyTwofaCodeReturnsFalseForExpiredCode":0.081,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testVerifyTwofaCodeReturnsTrueForValidCode":0.155,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSendTwofaCodeReturnsFalseWhen2FADisabled":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testSendTwofaCodeReturnsFalseForInvalidEmail":0.001,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testUpdateByIdCallsDbUpdate":0,"Tests\\Unit\\Domain\\User\\UserRepositoryTest::testListForAdminReturnsItemsAndTotal":0.001,"Tests\\Unit\\admin\\Controllers\\ArticlesArchiveControllerTest::testConstructorAcceptsRepository":0.002,"Tests\\Unit\\admin\\Controllers\\ArticlesArchiveControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\ArticlesArchiveControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\ArticlesArchiveControllerTest::testConstructorRequiresArticleRepository":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testConstructorAcceptsRepository":0.002,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testHasListMethod":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testHasEditMethod":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testHasSaveMethod":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testHasDeleteMethod":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\DictionariesControllerTest::testConstructorRequiresDictionariesRepository":0,"Tests\\Unit\\admin\\Controllers\\LanguagesControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\LanguagesControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\LanguagesControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\LanguagesControllerTest::testConstructorRequiresLanguagesRepository":0,"Tests\\Unit\\admin\\Controllers\\LayoutsControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\LayoutsControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\LayoutsControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\LayoutsControllerTest::testConstructorRequiresLayoutsRepository":0,"Tests\\Unit\\admin\\Controllers\\NewsletterControllerTest::testConstructorAcceptsDependencies":0.002,"Tests\\Unit\\admin\\Controllers\\NewsletterControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\NewsletterControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\NewsletterControllerTest::testConstructorRequiresRepositoryAndRenderer":0,"Tests\\Unit\\admin\\Controllers\\ScontainersControllerTest::testConstructorAcceptsDependencies":0.001,"Tests\\Unit\\admin\\Controllers\\ScontainersControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\ScontainersControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\ScontainersControllerTest::testConstructorRequiresRepositoryAndLanguagesRepository":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testConstructorAcceptsRepository":0.002,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasViewListMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasUserEditMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasUserSaveMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasUserDeleteMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasTwofaMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testHasLoginFormMethod":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testConstructorRequiresUserRepository":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testNormalizeUserReturnsDefaultsForNull":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testNormalizeUserCastsTypes":0,"Tests\\Unit\\admin\\Controllers\\UsersControllerTest::testNormalizeUserHandlesPartialData":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveFilesOrderUpdatesFilesOrder":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testSaveFilesOrderSkipsEmptyValues":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testPagesSummaryForArticlesBuildsLabels":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testUpdateImageAltDelegatesToDatabase":0,"Tests\\Unit\\Domain\\Article\\ArticleRepositoryTest::testMarkFileToDeleteDelegatesToDatabase":0,"Tests\\Unit\\Domain\\Coupon\\CouponRepositoryTest::testFindReturnsDefaultCouponForInvalidId":0.001,"Tests\\Unit\\Domain\\Coupon\\CouponRepositoryTest::testFindNormalizesCouponData":0,"Tests\\Unit\\Domain\\Coupon\\CouponRepositoryTest::testSaveInsertsCouponAndReturnsId":0,"Tests\\Unit\\Domain\\Coupon\\CouponRepositoryTest::testSaveUpdatesCouponAndReturnsId":0,"Tests\\Unit\\Domain\\Coupon\\CouponRepositoryTest::testDeleteReturnsFalseForInvalidId":0,"Tests\\Unit\\Domain\\Coupon\\CouponRepositoryTest::testDeleteReturnsTrueWhenDatabaseDeleteSucceeds":0,"Tests\\Unit\\Domain\\Coupon\\CouponRepositoryTest::testListForAdminWhitelistsSortAndDirection":0,"Tests\\Unit\\Domain\\Coupon\\CouponRepositoryTest::testCategoriesTreeReturnsHierarchy":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testGetSettingsReturnsArray":0.001,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testGetSettingReturnsValue":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testGetSettingReturnsNullWhenNotFound":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testSaveSettingUpdatesExistingValue":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testSaveSettingInsertsNewValue":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testInvalidProviderThrowsException":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testLinkProductUpdatesDatabase":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testUnlinkProductClearsFields":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testGetProductSkuReturnsValue":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testGetProductSkuReturnsNullForMissing":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testApiloGetAccessTokenReturnsNullWithoutSettings":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testApiloFetchListThrowsForInvalidType":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testAllPublicMethodsExist":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testSettingsTableMapping":0,"Tests\\Unit\\Domain\\Integrations\\IntegrationsRepositoryTest::testShopproProviderWorks":0,"Tests\\Unit\\Domain\\Pages\\PagesRepositoryTest::testMenusListReturnsArray":0.001,"Tests\\Unit\\Domain\\Pages\\PagesRepositoryTest::testMenuDeleteReturnsFalseWhenMenuHasPages":0,"Tests\\Unit\\Domain\\Pages\\PagesRepositoryTest::testGenerateSeoLinkAddsSuffixWhenBaseSlugExists":0,"Tests\\Unit\\Domain\\Pages\\PagesRepositoryTest::testPageUrlPreviewBuildsLanguagePrefixedUrlForNonDefaultLanguage":0,"Tests\\Unit\\Domain\\Promotion\\PromotionRepositoryTest::testFindReturnsDefaultPromotionForInvalidId":0.001,"Tests\\Unit\\Domain\\Promotion\\PromotionRepositoryTest::testSaveInsertsPromotionAndReturnsId":0,"Tests\\Unit\\Domain\\Promotion\\PromotionRepositoryTest::testDeleteReturnsFalseForInvalidId":0,"Tests\\Unit\\Domain\\Promotion\\PromotionRepositoryTest::testDeleteReturnsTrueWhenDatabaseDeleteSucceeds":0,"Tests\\Unit\\Domain\\Promotion\\PromotionRepositoryTest::testListForAdminWhitelistsSortAndDirection":0,"Tests\\Unit\\Domain\\Promotion\\PromotionRepositoryTest::testCategoriesTreeReturnsHierarchy":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasImageAltChangeMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasFileNameChangeMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasImageDeleteMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testHasFileDeleteMethod":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testImageAltChangeMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testFileNameChangeMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testImageDeleteMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\ArticlesControllerTest::testFileDeleteMethodReturnType":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testConstructorAcceptsDependencies":0.002,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testConstructorRequiresRepository":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testHasAllApiloSettingsMethods":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testHasAllApiloDataFetchMethods":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testHasAllApiloProductMethods":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testHasAllShopproMethods":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testApiloSettingsReturnsString":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testShopproSettingsReturnsString":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testVoidReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testDoesNotHaveSellasistMethods":0,"Tests\\Unit\\admin\\Controllers\\IntegrationsControllerTest::testDoesNotHaveBaselinkerMethods":0,"Tests\\Unit\\admin\\Controllers\\PagesControllerTest::testConstructorAcceptsRepositories":0.001,"Tests\\Unit\\admin\\Controllers\\PagesControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\PagesControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\PagesControllerTest::testConstructorRequiresPagesLanguagesAndLayoutsRepositories":0,"Tests\\Unit\\admin\\Controllers\\ShopCouponControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\ShopCouponControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\ShopCouponControllerTest::testHasLegacyAliasMethods":0,"Tests\\Unit\\admin\\Controllers\\ShopCouponControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\ShopCouponControllerTest::testConstructorRequiresCouponRepository":0,"Tests\\Unit\\admin\\Controllers\\ShopPromotionControllerTest::testConstructorAcceptsRepository":0.001,"Tests\\Unit\\admin\\Controllers\\ShopPromotionControllerTest::testHasMainActionMethods":0,"Tests\\Unit\\admin\\Controllers\\ShopPromotionControllerTest::testActionMethodReturnTypes":0,"Tests\\Unit\\admin\\Controllers\\ShopPromotionControllerTest::testConstructorRequiresPromotionRepository":0}} \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index 66c39d3..3c92d26 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,4 +28,4 @@ To ma pomóc zachować spójność zmian i dokumentacji. ## INNE -Przejdźmy teraz do refaktoringu wszystkiego co związane z https://shoppro.project-dc.pl/admin/articles_archive/, nowe widoki, klasy (usuwanie starych), poprawa routingu, przeszukanie innych klas pod względem zależności. Zapisz plan i przedstaw mi go a po akceptacji realizuj krok po kroku w trybie Human In The Loop \ No newline at end of file +Przejdźmy teraz do refaktoringu wszystkiego co związane z https://shoppro.project-dc.pl/admin/shop_coupon/, nowe widoki, klasy (usuwanie starych), poprawa routingu, przeszukanie innych klas pod względem zależności. Zapisz plan i przedstaw mi go a po akceptacji realizuj krok po kroku w trybie Human In The Loop \ No newline at end of file diff --git a/DATABASE_STRUCTURE.md b/DATABASE_STRUCTURE.md index 69ed2b1..385f34c 100644 --- a/DATABASE_STRUCTURE.md +++ b/DATABASE_STRUCTURE.md @@ -320,6 +320,28 @@ Tlumaczenia kontenerow statycznych (per jezyk). **Aktualizacja 2026-02-12 (ver. 0.260):** modul `/admin/articles_archive` korzysta z `Domain\Article\ArticleRepository` (`listArchivedForAdmin`, `restore`, `deletePermanently`) przez `admin\Controllers\ArticlesArchiveController`. +## pp_shop_coupon +Kody rabatowe sklepu (modul `/admin/shop_coupon`). + +| Kolumna | Opis | +|---------|------| +| id | PK | +| name | Kod kuponu (UNIQUE) | +| status | Status: 1 = aktywny, 0 = nieaktywny | +| send | Czy kupon zostal wyslany (0/1) | +| used | Czy kupon zostal wykorzystany (0/1) | +| date_used | Data wykorzystania kuponu (NULL gdy brak) | +| used_count | Licznik uzyc kuponu | +| type | Typ kuponu (obecnie: 1 = rabat procentowy na koszyk) | +| amount | Wartosc kuponu (np. procent) | +| one_time | Czy kupon jednorazowy (0/1) | +| include_discounted_product | Czy obejmuje rowniez produkty przecenione (0/1) | +| categories | JSON z ID kategorii objetych kuponem (NULL = bez ograniczenia) | + +**Uzywane w:** `Domain\Coupon\CouponRepository`, `admin\Controllers\ShopCouponController`, `shop\Coupon`, `front\factory\ShopCoupon`, `front\factory\ShopOrder` + +**Aktualizacja 2026-02-13 (ver. 0.266):** modul `/admin/shop_coupon` korzysta z `Domain\Coupon\CouponRepository` przez `admin\Controllers\ShopCouponController`. Usunieto legacy klasy `admin\controls\ShopCoupon` i `admin\factory\ShopCoupon`. + ## pp_shop_promotion Promocje sklepu (modul `/admin/shop_promotion`). diff --git a/PROJECT_STRUCTURE.md b/PROJECT_STRUCTURE.md index 819c691..7df694b 100644 --- a/PROJECT_STRUCTURE.md +++ b/PROJECT_STRUCTURE.md @@ -492,3 +492,14 @@ Aktualnie w suite są też testy modułów `Dictionaries`, `Articles` i `Users` - UPDATE: `shop\Promotion::get_active_promotions()` uwzglednia `date_from` (`NULL` lub `<= dzisiaj`) obok `date_to`. - FIX: edycja promocji zapisuje update zamiast insert (stabilne przekazanie `id` przez hidden field + fallback `id` z URL w `save()`). - Testy: **OK (222 tests, 614 assertions)**. + +## Aktualizacja 2026-02-13 (ShopCoupon refactor, ver. 0.266) +- NOWE: `Domain\Coupon\CouponRepository` (`listForAdmin`, `find`, `save`, `delete`, `categoriesTree`). +- NOWE: `admin\Controllers\ShopCouponController` (DI) dla akcji `list`, `edit`, `save`, `delete`. +- UPDATE: zachowana kompatybilnosc aliasow legacy akcji (`view_list`, `coupon_edit`, `coupon_save`, `coupon_delete`) w nowym kontrolerze. +- UPDATE: modul `/admin/shop_coupon/*` przepiety z legacy `grid/gridEdit` na `components/table-list` i `components/form-edit`. +- NOWE: widoki/partiale `shop-coupon/coupons-list`, `shop-coupon/coupon-edit-new`, `shop-coupon/coupon-categories-selector`, `shop-coupon/coupon-categories-tree`, `shop-coupon/coupon-edit-custom-script`. +- CLEANUP: usuniete legacy klasy/pliki `autoload/admin/controls/class.ShopCoupon.php`, `autoload/admin/factory/class.ShopCoupon.php`, `admin/templates/shop-coupon/view-list.php`, `admin/templates/shop-coupon/coupon-edit.php`. +- UPDATE: menu admin wskazuje kanoniczny URL `/admin/shop_coupon/list/`. +- FIX: ujednolicone zachowanie drzewek i styl checkboxow miedzy widokami `/admin/shop_coupon/edit/*` i `/admin/layouts/edit/*` (strzalki, focus, iCheck). +- Testy: **OK (235 tests, 682 assertions)**. diff --git a/REFACTORING_PLAN.md b/REFACTORING_PLAN.md index c0118bf..7aa43de 100644 --- a/REFACTORING_PLAN.md +++ b/REFACTORING_PLAN.md @@ -511,15 +511,15 @@ class BannerController { $formHandler = new FormRequestHandler(); $viewModel = $this->buildFormViewModel(); // jak w edit() - + $result = $formHandler->handleSubmit($viewModel, $_POST); - + if (!$result['success']) { // Błędy walidacji - zapisane automatycznie do sesji echo json_encode(['success' => false, 'errors' => $result['errors']]); exit; } - + // Sukces - persist wyczyszczony automatycznie $this->repository->save($result['data']); echo json_encode(['success' => true]); @@ -782,3 +782,92 @@ Gdy `persist = true`: - FIX: zapis edycji promocji nie tworzy nowego rekordu (hidden `id` + fallback `id` z URL) - TEST: rozszerzono `PromotionRepositoryTest` o asercje `date_from` - Testy po zmianie: **OK (222 tests, 614 assertions)**. + +## Plan 2026-02-13 - Refaktoryzacja `/admin/shop_coupon/` (HITL) +- [x] Etap 1 (analiza i kontrakt URL/routingu): + - potwierdzic docelowy kontrakt URL: `/admin/shop_coupon/list/`, `/admin/shop_coupon/edit/`, `/admin/shop_coupon/save/`, `/admin/shop_coupon/delete/` + - decyzja: utrzymujemy aliasy legacy (`view_list`, `coupon_edit`, `coupon_save`, `coupon_delete`) w nowym kontrolerze jako kompatybilnosc wsteczna, przy jednoczesnym przejsciu menu i nowych widokow na URL kanoniczne + - sprawdzic mapowanie modulu `ShopCoupon` w `admin\Site` (DI factory + fallback) +- [x] Etap 2 (Domain): + - dodac `Domain\Coupon\CouponRepository`: + - `listForAdmin(filters, sort, dir, page, perPage)` (whitelist sortowania + paginacja) + - `find(int $id)` (domyslne dane dla nowego formularza) + - `save(array $data): ?int` (insert/update, normalizacja switchy, JSON dla `categories`) + - `delete(int $id): bool` + - `categoriesTree(?int $parentId): array` (drzewo kategorii bez zaleznosci od `admin\factory\ShopCategory`) +- [x] Etap 3 (Admin Controller + routing DI): + - dodac `admin\Controllers\ShopCouponController` z akcjami `list`, `edit`, `save`, `delete` + - przepiac routing DI w `admin\Site::$newControllers` dla modulu `ShopCoupon` + - zachowac obsluge legacy payload `values` JSON i nowego payload `$_POST` z `components/form-edit` +- [x] Etap 4 (widoki): + - przepiac liste z `grid` na `components/table-list` (filtry: nazwa, aktywny, uzyty, wyslany) + - przepiac edycje z `gridEdit` na `components/form-edit` + - dodac partiale drzewa kategorii w module `shop-coupon` (usuniecie zaleznosci od `shop-product/subcategories-list`) + - dodac `shop-coupon/coupon-edit-custom-script.php` (obsluga drzewa kategorii i zachowania formularza) +- [x] Etap 5 (cleanup i zaleznosci): + - usunac legacy po pelnym przepieciu: + - `autoload/admin/controls/class.ShopCoupon.php` + - `autoload/admin/factory/class.ShopCoupon.php` + - `admin/templates/shop-coupon/view-list.php` (wersja grid) + - `admin/templates/shop-coupon/coupon-edit.php` (wersja gridEdit) + - przepiac menu admin na kanoniczny URL `/admin/shop_coupon/list/` + - przeszukac repo i usunac pozostale odwolania do `shop_coupon/view_list` i legacy klas `admin\controls\ShopCoupon`, `admin\factory\ShopCoupon` +- [x] Etap 6 (testy): + - dodac `tests/Unit/Domain/Coupon/CouponRepositoryTest.php` + - dodac `tests/Unit/admin/Controllers/ShopCouponControllerTest.php` + - uruchomic testy modulu + pelny `composer test` +- [x] Etap 7 (dokumentacja i release note): + - zaktualizowac `DATABASE_STRUCTURE.md` (dodac `pp_shop_coupon`) + - zaktualizowac `PROJECT_STRUCTURE.md` + - zaktualizowac `REFACTORING_PLAN.md` (sekcja "Aktualizacja ...") + - zaktualizowac `TESTING.md` (nowy wynik suite + nowe testy) + - dopisac wpis w `updates/changelog.php` + +### Tryb HITL dla realizacji +- Po kazdym etapie (1-7) zatrzymanie i krotkie podsumowanie diffu do akceptacji przed kolejnym krokiem. + +### Postep 2026-02-13 (ShopCoupon) +- Etap 2 zakonczony: + - NOWE: `autoload/Domain/Coupon/CouponRepository.php` + - Zakres: `listForAdmin`, `find`, `save`, `delete`, `categoriesTree` + - Walidacja: `php -l` OK +- Etap 3 zakonczony: + - NOWE: `autoload/admin/Controllers/ShopCouponController.php` + - UPDATE: `autoload/admin/class.Site.php` - rejestracja DI factory dla modulu `ShopCoupon` + - Kompatybilnosc: dodane aliasy akcji `view_list`, `coupon_edit`, `coupon_save`, `coupon_delete` + - Walidacja: `php -l` OK +- Etap 4 zakonczony: + - NOWE widoki: `admin/templates/shop-coupon/coupons-list.php`, `admin/templates/shop-coupon/coupon-edit-new.php` + - NOWE partiale: `admin/templates/shop-coupon/coupon-categories-selector.php`, `admin/templates/shop-coupon/coupon-categories-tree.php` + - NOWY skrypt: `admin/templates/shop-coupon/coupon-edit-custom-script.php` + - UPDATE: `ShopCouponController::edit()` buduje `FormEditViewModel` (zakladki ustawienia/kategorie) + - Walidacja: `php -l` OK +- Etap 5 zakonczony: + - CLEANUP: usuniete pliki legacy: + - `autoload/admin/controls/class.ShopCoupon.php` + - `autoload/admin/factory/class.ShopCoupon.php` + - `admin/templates/shop-coupon/view-list.php` + - `admin/templates/shop-coupon/coupon-edit.php` + - UPDATE: menu admin (`admin/templates/site/main-layout.php`) wskazuje kanoniczny URL `/admin/shop_coupon/list/` + - WERYFIKACJA: brak odwolan do `shop_coupon/view_list`, `admin\controls\ShopCoupon`, `admin\factory\ShopCoupon` w kodzie +- Etap 6 zakonczony: + - NOWE testy: + - `tests/Unit/Domain/Coupon/CouponRepositoryTest.php` (8 testow) + - `tests/Unit/admin/Controllers/ShopCouponControllerTest.php` (5 testow) + - Test modulu: `OK (8 tests, 49 assertions)` + - Pelny suite: `OK (235 tests, 682 assertions)` +- Etap 7 zakonczony: + - UPDATE: dokumentacja techniczna zaktualizowana (`DATABASE_STRUCTURE.md`, `PROJECT_STRUCTURE.md`, `TESTING.md`) + - UPDATE: dopisany release note w `updates/changelog.php` (ver. 0.266) + +## Aktualizacja 2026-02-13 (ver. 0.266) +- **ShopCoupon** - migracja `/admin/shop_coupon` na Domain + DI + nowe widoki + - NOWE: `Domain\Coupon\CouponRepository` (`listForAdmin`, `find`, `save`, `delete`, `categoriesTree`) + - NOWE: `admin\Controllers\ShopCouponController` (DI) z akcjami `list`, `edit`, `save`, `delete` + - UPDATE: kompatybilnosc aliasow legacy (`view_list`, `coupon_edit`, `coupon_save`, `coupon_delete`) obslugiwana przez nowy kontroler + - UPDATE: modul `/admin/shop_coupon/*` dziala na `components/table-list` i `components/form-edit` + - NOWE: widoki/partiale `shop-coupon/coupons-list`, `shop-coupon/coupon-edit-new`, `shop-coupon/coupon-categories-selector`, `shop-coupon/coupon-categories-tree`, `shop-coupon/coupon-edit-custom-script` + - CLEANUP: usuniete legacy `autoload/admin/controls/class.ShopCoupon.php`, `autoload/admin/factory/class.ShopCoupon.php`, `admin/templates/shop-coupon/view-list.php`, `admin/templates/shop-coupon/coupon-edit.php` + - UPDATE: menu admin przepiete na kanoniczny URL `/admin/shop_coupon/list/` + - FIX: po akceptacji HITL ujednolicone UI drzewek i checkboxow miedzy kuponami i layoutami (spojne strzalki, brak nieestetycznego focusu, iCheck dla checkboxow) +- Testy po zmianie: **OK (235 tests, 682 assertions)**. diff --git a/TESTING.md b/TESTING.md index 11d99f9..d7675b0 100644 --- a/TESTING.md +++ b/TESTING.md @@ -33,10 +33,10 @@ Alternatywnie (Git Bash): ## Aktualny stan suite -Ostatnio zweryfikowano: 2026-02-10 +Ostatnio zweryfikowano: 2026-02-13 ```text -OK (82 tests, 181 assertions) +OK (235 tests, 682 assertions) ``` ## Struktura testow @@ -49,6 +49,7 @@ tests/ | | |-- Article/ArticleRepositoryTest.php | | |-- Banner/BannerRepositoryTest.php | | |-- Cache/CacheRepositoryTest.php +| | |-- Coupon/CouponRepositoryTest.php | | |-- Dictionaries/DictionariesRepositoryTest.php | | |-- Product/ProductRepositoryTest.php | | |-- Settings/SettingsRepositoryTest.php @@ -61,6 +62,7 @@ tests/ | |-- IntegrationsControllerTest.php | |-- ProductArchiveControllerTest.php | |-- SettingsControllerTest.php +| |-- ShopCouponControllerTest.php | `-- UsersControllerTest.php `-- Integration/ ``` @@ -318,3 +320,17 @@ OK (222 tests, 614 assertions) Zmiany testowe 2026-02-13: - rozszerzenie `tests/Unit/Domain/Promotion/PromotionRepositoryTest.php` o asercje `date_from` + +## Aktualizacja suite (ShopCoupon refactor, ver. 0.266) +Ostatnio zweryfikowano: 2026-02-13 + +```text +OK (235 tests, 682 assertions) +``` + +Nowe testy dodane 2026-02-13: +- `tests/Unit/Domain/Coupon/CouponRepositoryTest.php` (8 testow: find default/normalize, save insert/update, delete, whitelist sortowania, drzewo kategorii) +- `tests/Unit/admin/Controllers/ShopCouponControllerTest.php` (5 testow: kontrakty metod, aliasy legacy, DI konstruktora) + +Ponowna weryfikacja po poprawkach UI (drzewko + checkboxy): 2026-02-13 +- `OK (235 tests, 682 assertions)` diff --git a/admin/templates/layouts/layout-edit.php b/admin/templates/layouts/layout-edit.php index 2de458c..1885bc3 100644 --- a/admin/templates/layouts/layout-edit.php +++ b/admin/templates/layouts/layout-edit.php @@ -7,6 +7,48 @@ + ">
  • - + ';?> layout['categories'] ) and in_array( $category['id'], $this -> layout['categories'] ) ):?>checked="checked" /> dlang]['title'];?> diff --git a/admin/templates/layouts/subcategories-list.php b/admin/templates/layouts/subcategories-list.php index e1e5bf5..72880f2 100644 --- a/admin/templates/layouts/subcategories-list.php +++ b/admin/templates/layouts/subcategories-list.php @@ -3,7 +3,9 @@ categories as $category ):?>
  • - + ';?> product_categories ) and in_array( $category['id'], $this -> product_categories ) ):?>checked="checked" /> dlang]['title'];?> @@ -17,4 +19,3 @@ - diff --git a/admin/templates/layouts/subpages-list.php b/admin/templates/layouts/subpages-list.php index 3f68d21..61fd7eb 100644 --- a/admin/templates/layouts/subpages-list.php +++ b/admin/templates/layouts/subpages-list.php @@ -3,7 +3,9 @@ pages as $page ):?>
  • > - + layout_pages ) and in_array( $page['id'], $this -> layout_pages ) ):?>checked="checked" />
    label ?? 'Kategorie')); +$inputName = trim((string)($this->inputName ?? 'categories[]')); +$categories = is_array($this->categories ?? null) ? $this->categories : []; +$selectedIds = is_array($this->selectedIds ?? null) ? $this->selectedIds : []; +?> +
    + +
    +
    + $categories, + 'selectedIds' => $selectedIds, + 'inputName' => $inputName, + ]); ?> +
    +
    +
    + diff --git a/admin/templates/shop-coupon/coupon-categories-tree.php b/admin/templates/shop-coupon/coupon-categories-tree.php new file mode 100644 index 0000000..5a22b24 --- /dev/null +++ b/admin/templates/shop-coupon/coupon-categories-tree.php @@ -0,0 +1,68 @@ +categories ?? null) ? $this->categories : []; +$inputName = trim((string)($this->inputName ?? 'categories[]')); +$selectedRaw = is_array($this->selectedIds ?? null) ? $this->selectedIds : []; +$selected = []; +foreach ($selectedRaw as $value) { + $id = (int)$value; + if ($id > 0) { + $selected[$id] = true; + } +} +?> + +
      + + +
    1. +
      + + + + + + + + + + + +
      + + + $children, + 'selectedIds' => array_keys($selected), + 'inputName' => $inputName, + ]); ?> + +
    2. + +
    + + diff --git a/admin/templates/shop-coupon/coupon-edit-custom-script.php b/admin/templates/shop-coupon/coupon-edit-custom-script.php new file mode 100644 index 0000000..5cb6115 --- /dev/null +++ b/admin/templates/shop-coupon/coupon-edit-custom-script.php @@ -0,0 +1,109 @@ + + + diff --git a/admin/templates/shop-coupon/coupon-edit-new.php b/admin/templates/shop-coupon/coupon-edit-new.php new file mode 100644 index 0000000..06f6ba8 --- /dev/null +++ b/admin/templates/shop-coupon/coupon-edit-new.php @@ -0,0 +1,3 @@ + $this->form]); ?> + + diff --git a/admin/templates/shop-coupon/coupon-edit.php b/admin/templates/shop-coupon/coupon-edit.php deleted file mode 100644 index 724ff80..0000000 --- a/admin/templates/shop-coupon/coupon-edit.php +++ /dev/null @@ -1,151 +0,0 @@ - - - - -
    - -
    -
    - 'Nazwa', - 'name' => 'name', - 'id' => 'name', - 'value' => $this -> coupon['name'] - ]); ?> - 'Wysłany', - 'name' => 'send', - 'checked' => $this -> coupon['send'] == 1 ? true : false - ]); ?> - 'Aktywny', - 'name' => 'status', - 'checked' => $this -> coupon['status'] == 1 ? true : false - ]); ?> - 'Użyty', - 'name' => 'used', - 'checked' => $this -> coupon['used'] == 1 ? true : false, - ]); ?> - 'Typ kuponu', - 'name' => 'type', - 'values' => [ 1 => 'Rabat procentowy na koszyk'], - 'value' => $this -> coupo['type'], - ]); ?> - 'Wartość', - 'class' => 'number-format', - 'name' => 'amount', - 'id' => 'amount', - 'value' => $this -> coupon['amount'] - ]); ?> - 'Kupon jednorazowy', - 'name' => 'one_time', - 'checked' => $this -> coupon['one_time'] == 1 ? true : false - ]); ?> - 'Dotyczy również produktów przecenionych', - 'name' => 'include_discounted_product', - 'checked' => $this -> coupon['include_discounted_product'] == 1 ? true : false, - ]); ?> -
    - -
    - -
    -
    -
    -
    -
    -
    -id = 'coupon-edit'; -$grid->gdb_opt = $gdb; -$grid->include_plugins = true; -$grid->title = $this -> coupon['id'] ? 'Edycja kuponu: ' . $this -> coupon['name'] . '' : 'Nowy kupon'; -$grid->fields = [ - [ - 'db' => 'id', - 'type' => 'hidden', - 'value' => $this -> coupon['id'] - ] -]; -$grid->actions = [ - 'save' => ['url' => '/admin/shop_coupon/coupon_save/', 'back_url' => '/admin/shop_coupon/view_list/'], - 'cancel' => ['url' => '/admin/shop_coupon/view_list/'] -]; -$grid->external_code = $out; -$grid->persist_edit = true; -$grid->id_param = 'id'; - -echo $grid->draw(); -?> - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/admin/templates/shop-coupon/coupons-list.php b/admin/templates/shop-coupon/coupons-list.php new file mode 100644 index 0000000..b336124 --- /dev/null +++ b/admin/templates/shop-coupon/coupons-list.php @@ -0,0 +1,2 @@ + $this->viewModel]); ?> + diff --git a/admin/templates/shop-coupon/view-list.php b/admin/templates/shop-coupon/view-list.php deleted file mode 100644 index 08b5493..0000000 --- a/admin/templates/shop-coupon/view-list.php +++ /dev/null @@ -1,88 +0,0 @@ - gdb_opt = $gdb; -$grid -> debug = true; -$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ]; -$grid -> search = [ - [ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ], - [ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ], - [ 'name' => 'Użyty', 'db' => 'used', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ], - [ 'name' => 'Wysłany', 'db' => 'send', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ] - ]; -$grid -> columns_view = [ - [ - 'name' => 'Lp.', - 'th' => [ 'class' => 'g-lp' ], - 'td' => [ 'class' => 'g-center' ], - 'autoincrement' => true - ], [ - 'name' => 'Aktywny', - 'db' => 'status', - 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ], - 'td' => [ 'class' => 'g-center' ], - 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ], - 'sort' => true - ], [ - 'name' => 'Użyto X razy', - 'db' => 'used_count', - 'td' => [ 'class' => 'g-center' ], - 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ], - ], [ - 'name' => 'Nazwa', - 'db' => 'name', - 'sort' => true, - 'php' => 'echo "[name]";' - ], [ - 'name' => 'Typ kuponu', - 'db' => 'type', - 'replace' => [ 'array' => [ 1 => 'Rabat procentowy na koszyk' ] ] - ], [ - 'name' => 'Wartość', - 'db' => 'amount', - 'php' => 'if ( [type] == 1 ) echo "[amount]%";' - ], [ - 'name' => 'Kupon jednorazowy', - 'db' => 'one_time', - 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ], - 'td' => [ 'class' => 'g-center' ], - 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ] - ], [ - 'name' => 'Wysłany', - 'db' => 'send', - 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ], - 'td' => [ 'class' => 'g-center' ], - 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ] - ], [ - 'name' => 'Użyty', - 'db' => 'used', - 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ], - 'td' => [ 'class' => 'g-center' ], - 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ] - ], [ - 'name' => 'Data użycia', - 'db' => 'date_used', - 'td' => [ 'class' => 'g-center' ], - 'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ] - ], [ - 'name' => 'Edytuj', - 'action' => [ 'type' => 'edit', 'url' => '/admin/shop_coupon/coupon_edit/id=[id]' ], - 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ], - 'td' => [ 'class' => 'g-center' ] - ], [ - 'name' => 'Usuń', - 'action' => [ 'type' => 'delete', 'url' => '/admin/shop_coupon/coupon_delete/id=[id]' ], - 'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ], - 'td' => [ 'class' => 'g-center' ] - ] - ]; -$grid -> buttons = [ - [ - 'label' => 'Dodaj kupon', - 'url' => '/admin/shop_coupon/coupon_edit/', - 'icon' => 'fa-plus-circle', - 'class' => 'btn-success' - ] - ]; -echo $grid -> draw(); \ No newline at end of file diff --git a/admin/templates/site/main-layout.php b/admin/templates/site/main-layout.php index aeeb88d..847f84d 100644 --- a/admin/templates/site/main-layout.php +++ b/admin/templates/site/main-layout.php @@ -75,7 +75,7 @@
  • Statusy zamówień
  • -
  • Kody rabatowe
  • +
  • Kody rabatowe
  • Promocje
  • Zawartość
    @@ -197,6 +197,55 @@ diff --git a/autoload/Domain/Article/ArticleRepository.php b/autoload/Domain/Article/ArticleRepository.php index 41f7360..968a04f 100644 --- a/autoload/Domain/Article/ArticleRepository.php +++ b/autoload/Domain/Article/ArticleRepository.php @@ -602,6 +602,7 @@ class ArticleRepository ]); } + \S::delete_dir('../temp/'); return true; } @@ -636,6 +637,7 @@ class ArticleRepository } } + \S::delete_dir('../temp/'); return true; } diff --git a/autoload/Domain/Banner/BannerRepository.php b/autoload/Domain/Banner/BannerRepository.php index 083a13a..b2f8ee1 100644 --- a/autoload/Domain/Banner/BannerRepository.php +++ b/autoload/Domain/Banner/BannerRepository.php @@ -102,6 +102,8 @@ class BannerRepository $this->saveTranslations($bannerId, $data['src'], $data['url'], $data['html'], $data['text']); } + \S::delete_dir('../temp/'); + return (int)$bannerId; } diff --git a/autoload/Domain/Coupon/CouponRepository.php b/autoload/Domain/Coupon/CouponRepository.php new file mode 100644 index 0000000..2287289 --- /dev/null +++ b/autoload/Domain/Coupon/CouponRepository.php @@ -0,0 +1,391 @@ +db = $db; + } + + /** + * @return array{items: array>, total: int} + */ + public function listForAdmin( + array $filters, + string $sortColumn = 'name', + string $sortDir = 'ASC', + int $page = 1, + int $perPage = 15 + ): array { + $allowedSortColumns = [ + 'id' => 'sc.id', + 'status' => 'sc.status', + 'used_count' => 'sc.used_count', + 'name' => 'sc.name', + 'type' => 'sc.type', + 'amount' => 'sc.amount', + 'one_time' => 'sc.one_time', + 'send' => 'sc.send', + 'used' => 'sc.used', + 'date_used' => 'sc.date_used', + ]; + + $sortSql = $allowedSortColumns[$sortColumn] ?? 'sc.name'; + $sortDir = strtoupper(trim($sortDir)) === 'DESC' ? 'DESC' : 'ASC'; + $page = max(1, $page); + $perPage = min(self::MAX_PER_PAGE, max(1, $perPage)); + $offset = ($page - 1) * $perPage; + + $where = ['1 = 1']; + $params = []; + + $name = trim((string)($filters['name'] ?? '')); + if ($name !== '') { + if (strlen($name) > 255) { + $name = substr($name, 0, 255); + } + $where[] = 'sc.name LIKE :name'; + $params[':name'] = '%' . $name . '%'; + } + + $status = trim((string)($filters['status'] ?? '')); + if ($status === '0' || $status === '1') { + $where[] = 'sc.status = :status'; + $params[':status'] = (int)$status; + } + + $used = trim((string)($filters['used'] ?? '')); + if ($used === '0' || $used === '1') { + $where[] = 'sc.used = :used'; + $params[':used'] = (int)$used; + } + + $send = trim((string)($filters['send'] ?? '')); + if ($send === '0' || $send === '1') { + $where[] = 'sc.send = :send'; + $params[':send'] = (int)$send; + } + + $whereSql = implode(' AND ', $where); + + $sqlCount = " + SELECT COUNT(0) + FROM pp_shop_coupon AS sc + WHERE {$whereSql} + "; + + $stmtCount = $this->db->query($sqlCount, $params); + $countRows = $stmtCount ? $stmtCount->fetchAll() : []; + $total = isset($countRows[0][0]) ? (int)$countRows[0][0] : 0; + + $sql = " + SELECT + sc.id, + sc.name, + sc.status, + sc.used, + sc.type, + sc.amount, + sc.one_time, + sc.send, + sc.include_discounted_product, + sc.categories, + sc.date_used, + sc.used_count + FROM pp_shop_coupon AS sc + WHERE {$whereSql} + ORDER BY {$sortSql} {$sortDir}, sc.id DESC + LIMIT {$perPage} OFFSET {$offset} + "; + + $stmt = $this->db->query($sql, $params); + $items = $stmt ? $stmt->fetchAll() : []; + + if (!is_array($items)) { + $items = []; + } + + foreach ($items as &$item) { + $item['id'] = (int)($item['id'] ?? 0); + $item['status'] = $this->toSwitchValue($item['status'] ?? 0); + $item['used'] = $this->toSwitchValue($item['used'] ?? 0); + $item['one_time'] = $this->toSwitchValue($item['one_time'] ?? 0); + $item['send'] = $this->toSwitchValue($item['send'] ?? 0); + $item['used_count'] = (int)($item['used_count'] ?? 0); + $item['type'] = (int)($item['type'] ?? 1); + $item['categories'] = $this->decodeIdList($item['categories'] ?? null); + } + unset($item); + + return [ + 'items' => $items, + 'total' => $total, + ]; + } + + public function find(int $couponId): array + { + if ($couponId <= 0) { + return $this->defaultCoupon(); + } + + $coupon = $this->db->get('pp_shop_coupon', '*', ['id' => $couponId]); + if (!is_array($coupon)) { + return $this->defaultCoupon(); + } + + $coupon['id'] = (int)($coupon['id'] ?? 0); + $coupon['status'] = $this->toSwitchValue($coupon['status'] ?? 0); + $coupon['send'] = $this->toSwitchValue($coupon['send'] ?? 0); + $coupon['used'] = $this->toSwitchValue($coupon['used'] ?? 0); + $coupon['one_time'] = $this->toSwitchValue($coupon['one_time'] ?? 0); + $coupon['include_discounted_product'] = $this->toSwitchValue($coupon['include_discounted_product'] ?? 0); + $coupon['type'] = (int)($coupon['type'] ?? 1); + $coupon['used_count'] = (int)($coupon['used_count'] ?? 0); + $coupon['categories'] = $this->decodeIdList($coupon['categories'] ?? null); + + return $coupon; + } + + public function save(array $data): ?int + { + $couponId = (int)($data['id'] ?? 0); + + $row = [ + 'name' => trim((string)($data['name'] ?? '')), + 'status' => $this->toSwitchValue($data['status'] ?? 0), + 'send' => $this->toSwitchValue($data['send'] ?? 0), + 'used' => $this->toSwitchValue($data['used'] ?? 0), + 'type' => (int)($data['type'] ?? 1), + 'amount' => $this->toNullableNumeric($data['amount'] ?? null), + 'one_time' => $this->toSwitchValue($data['one_time'] ?? 0), + 'include_discounted_product' => $this->toSwitchValue($data['include_discounted_product'] ?? 0), + 'categories' => $this->encodeIdList($data['categories'] ?? null), + ]; + + if ($couponId <= 0) { + $this->db->insert('pp_shop_coupon', $row); + $id = (int)$this->db->id(); + return $id > 0 ? $id : null; + } + + $this->db->update('pp_shop_coupon', $row, ['id' => $couponId]); + return $couponId; + } + + public function delete(int $couponId): bool + { + if ($couponId <= 0) { + return false; + } + + return (bool)$this->db->delete('pp_shop_coupon', ['id' => $couponId]); + } + + /** + * @return array> + */ + public function categoriesTree($parentId = null): array + { + $rows = $this->db->select('pp_shop_categories', ['id'], [ + 'parent_id' => $parentId, + 'ORDER' => ['o' => 'ASC'], + ]); + + if (!is_array($rows)) { + return []; + } + + $categories = []; + foreach ($rows as $row) { + $categoryId = (int)($row['id'] ?? 0); + if ($categoryId <= 0) { + continue; + } + + $category = $this->db->get('pp_shop_categories', '*', ['id' => $categoryId]); + if (!is_array($category)) { + continue; + } + + $translations = $this->db->select('pp_shop_categories_langs', '*', ['category_id' => $categoryId]); + $category['languages'] = []; + if (is_array($translations)) { + foreach ($translations as $translation) { + $langId = (string)($translation['lang_id'] ?? ''); + if ($langId !== '') { + $category['languages'][$langId] = $translation; + } + } + } + + $category['title'] = $this->categoryTitle($category['languages']); + $category['subcategories'] = $this->categoriesTree($categoryId); + $categories[] = $category; + } + + return $categories; + } + + private function defaultCoupon(): array + { + return [ + 'id' => 0, + 'name' => '', + 'status' => 1, + 'send' => 0, + 'used' => 0, + 'type' => 1, + 'amount' => null, + 'one_time' => 1, + 'include_discounted_product' => 0, + 'categories' => [], + 'used_count' => 0, + 'date_used' => null, + ]; + } + + private function toSwitchValue($value): int + { + if (is_bool($value)) { + return $value ? 1 : 0; + } + + if (is_numeric($value)) { + return ((int)$value) === 1 ? 1 : 0; + } + + if (is_string($value)) { + $normalized = strtolower(trim($value)); + return in_array($normalized, ['1', 'on', 'true', 'yes'], true) ? 1 : 0; + } + + return 0; + } + + private function toNullableNumeric($value): ?string + { + if ($value === null) { + return null; + } + + $stringValue = trim((string)$value); + if ($stringValue === '') { + return null; + } + + return str_replace(',', '.', $stringValue); + } + + private function encodeIdList($values): ?string + { + $ids = $this->normalizeIdList($values); + if (empty($ids)) { + return null; + } + + return json_encode($ids); + } + + /** + * @return int[] + */ + private function decodeIdList($raw): array + { + if (is_array($raw)) { + return $this->normalizeIdList($raw); + } + + $text = trim((string)$raw); + if ($text === '') { + return []; + } + + $decoded = json_decode($text, true); + if (!is_array($decoded)) { + return []; + } + + return $this->normalizeIdList($decoded); + } + + /** + * @return int[] + */ + private function normalizeIdList($values): array + { + if ($values === null) { + return []; + } + + if (!is_array($values)) { + $text = trim((string)$values); + if ($text === '') { + return []; + } + + if (strpos($text, ',') !== false) { + $values = explode(',', $text); + } else { + $values = [$text]; + } + } + + $ids = []; + foreach ($values as $value) { + $id = (int)$value; + if ($id > 0) { + $ids[$id] = $id; + } + } + + return array_values($ids); + } + + private function categoryTitle(array $languages): string + { + $defaultLang = $this->defaultLanguageId(); + if ($defaultLang !== '' && isset($languages[$defaultLang]['title'])) { + $title = trim((string)$languages[$defaultLang]['title']); + if ($title !== '') { + return $title; + } + } + + foreach ($languages as $language) { + $title = trim((string)($language['title'] ?? '')); + if ($title !== '') { + return $title; + } + } + + return ''; + } + + private function defaultLanguageId(): string + { + if ($this->defaultLangId !== null) { + return $this->defaultLangId; + } + + $rows = $this->db->select('pp_langs', ['id', 'start', 'o'], [ + 'status' => 1, + 'ORDER' => ['start' => 'DESC', 'o' => 'ASC'], + ]); + + if (is_array($rows) && !empty($rows)) { + $this->defaultLangId = (string)($rows[0]['id'] ?? ''); + } else { + $this->defaultLangId = ''; + } + + return $this->defaultLangId; + } +} + diff --git a/autoload/Domain/Dictionaries/DictionariesRepository.php b/autoload/Domain/Dictionaries/DictionariesRepository.php index 8fe6aeb..30169ca 100644 --- a/autoload/Domain/Dictionaries/DictionariesRepository.php +++ b/autoload/Domain/Dictionaries/DictionariesRepository.php @@ -249,6 +249,7 @@ class DictionariesRepository private function clearCache(): void { if (class_exists('\S') && method_exists('\S', 'delete_dir')) { + \S::delete_dir('../temp/'); \S::delete_dir('../temp/dictionaries'); } } diff --git a/autoload/Domain/Integrations/IntegrationsRepository.php b/autoload/Domain/Integrations/IntegrationsRepository.php index 28f62a0..9a70801 100644 --- a/autoload/Domain/Integrations/IntegrationsRepository.php +++ b/autoload/Domain/Integrations/IntegrationsRepository.php @@ -51,6 +51,7 @@ class IntegrationsRepository } else { $this->db->insert( $table, [ 'name' => $name, 'value' => $value ] ); } + \S::delete_dir('../temp/'); return true; } diff --git a/autoload/Domain/Layouts/LayoutsRepository.php b/autoload/Domain/Layouts/LayoutsRepository.php index 7cf6be6..093282a 100644 --- a/autoload/Domain/Layouts/LayoutsRepository.php +++ b/autoload/Domain/Layouts/LayoutsRepository.php @@ -18,7 +18,13 @@ class LayoutsRepository return false; } - return (bool)$this->db->delete('pp_layouts', ['id' => $layoutId]); + $deleted = (bool)$this->db->delete('pp_layouts', ['id' => $layoutId]); + if ($deleted) { + \S::delete_dir('../temp/'); + $this->clearFrontLayoutsCache(); + } + + return $deleted; } public function find(int $layoutId): array @@ -77,6 +83,7 @@ class LayoutsRepository $this->syncCategories($layoutId, $data['categories'] ?? []); \S::delete_dir('../temp/'); + $this->clearFrontLayoutsCache(); return $layoutId; } @@ -288,6 +295,22 @@ class LayoutsRepository ]; } + private function clearFrontLayoutsCache(): void + { + if (!class_exists('\CacheHandler')) { + return; + } + + try { + $cacheHandler = new \CacheHandler(); + if (method_exists($cacheHandler, 'deletePattern')) { + $cacheHandler->deletePattern('*Layouts::*'); + } + } catch (\Throwable $e) { + // Inwalidacja cache nie moze blokowac zapisu/usuwania. + } + } + private function menuPages(int $menuId, $parentId = null): array { if ($menuId <= 0) { diff --git a/autoload/Domain/Newsletter/NewsletterRepository.php b/autoload/Domain/Newsletter/NewsletterRepository.php index 7f7e63e..cdf7da9 100644 --- a/autoload/Domain/Newsletter/NewsletterRepository.php +++ b/autoload/Domain/Newsletter/NewsletterRepository.php @@ -25,6 +25,7 @@ class NewsletterRepository { $this->settingsRepository->updateSetting('newsletter_footer', (string)($values['newsletter_footer'] ?? '')); $this->settingsRepository->updateSetting('newsletter_header', (string)($values['newsletter_header'] ?? '')); + \S::delete_dir('../temp/'); return true; } @@ -289,4 +290,3 @@ class NewsletterRepository ]; } } - diff --git a/autoload/Domain/Pages/PagesRepository.php b/autoload/Domain/Pages/PagesRepository.php index 7c9a941..b897666 100644 --- a/autoload/Domain/Pages/PagesRepository.php +++ b/autoload/Domain/Pages/PagesRepository.php @@ -172,6 +172,9 @@ class PagesRepository 'status' => $statusValue, ]); + if ($result) { + \S::delete_dir('../temp/'); + } return (bool)$result; } @@ -182,6 +185,7 @@ class PagesRepository 'id' => $menuId, ]); + \S::delete_dir('../temp/'); return true; } @@ -278,6 +282,7 @@ class PagesRepository ]); } + \S::delete_dir('../temp/'); return true; } diff --git a/autoload/Domain/Promotion/PromotionRepository.php b/autoload/Domain/Promotion/PromotionRepository.php index 9222431..41d7239 100644 --- a/autoload/Domain/Promotion/PromotionRepository.php +++ b/autoload/Domain/Promotion/PromotionRepository.php @@ -148,11 +148,13 @@ class PromotionRepository } $this->invalidateActivePromotionsCache(); + \S::delete_dir('../temp/'); return $id; } $this->db->update('pp_shop_promotion', $row, ['id' => $promotionId]); $this->invalidateActivePromotionsCache(); + \S::delete_dir('../temp/'); return $promotionId; } diff --git a/autoload/Domain/Settings/SettingsRepository.php b/autoload/Domain/Settings/SettingsRepository.php index 2a0969a..64e7acb 100644 --- a/autoload/Domain/Settings/SettingsRepository.php +++ b/autoload/Domain/Settings/SettingsRepository.php @@ -90,6 +90,7 @@ class SettingsRepository // Zachowanie zgodne z dotychczasowym flow: pelna podmiana zestawu ustawien. $this->db->query('TRUNCATE pp_settings'); $this->updateSettings($settingsToSave); + \S::delete_dir('../temp/'); \S::set_message('Ustawienia zostaly zapisane'); diff --git a/autoload/Domain/User/UserRepository.php b/autoload/Domain/User/UserRepository.php index 4518670..6025886 100644 --- a/autoload/Domain/User/UserRepository.php +++ b/autoload/Domain/User/UserRepository.php @@ -154,6 +154,7 @@ class UserRepository ]); if ($inserted) { + \S::delete_dir('../temp/'); return ['status' => 'ok', 'msg' => 'Uzytkownik zostal zapisany.']; } @@ -186,6 +187,7 @@ class UserRepository 'id' => $userId, ]); + \S::delete_dir('../temp/'); return ['status' => 'ok', 'msg' => 'Uzytkownik zostal zapisany.']; } diff --git a/autoload/admin/Controllers/BannerController.php b/autoload/admin/Controllers/BannerController.php index 8828e58..84016a3 100644 --- a/autoload/admin/Controllers/BannerController.php +++ b/autoload/admin/Controllers/BannerController.php @@ -210,7 +210,6 @@ class BannerController $savedId = $this->repository->save($data); if ($savedId) { - \S::delete_dir('../temp/'); $response = [ 'success' => true, 'id' => $savedId, diff --git a/autoload/admin/Controllers/ShopCouponController.php b/autoload/admin/Controllers/ShopCouponController.php new file mode 100644 index 0000000..9025bf2 --- /dev/null +++ b/autoload/admin/Controllers/ShopCouponController.php @@ -0,0 +1,353 @@ +repository = $repository; + } + + public function list(): string + { + $sortableColumns = ['id', 'status', 'used_count', 'name', 'type', 'amount', 'one_time', 'send', 'used', 'date_used']; + $filterDefinitions = [ + [ + 'key' => 'name', + 'label' => 'Nazwa', + 'type' => 'text', + ], + [ + 'key' => 'status', + 'label' => 'Aktywny', + 'type' => 'select', + 'options' => [ + '' => '- aktywny -', + '1' => 'tak', + '0' => 'nie', + ], + ], + [ + 'key' => 'used', + 'label' => 'Uzyty', + 'type' => 'select', + 'options' => [ + '' => '- uzyty -', + '1' => 'tak', + '0' => 'nie', + ], + ], + [ + 'key' => 'send', + 'label' => 'Wyslany', + 'type' => 'select', + 'options' => [ + '' => '- wyslany -', + '1' => 'tak', + '0' => 'nie', + ], + ], + ]; + + $listRequest = \admin\Support\TableListRequestFactory::fromRequest( + $filterDefinitions, + $sortableColumns, + 'name' + ); + + $sortDir = $listRequest['sortDir']; + if (trim((string)\S::get('sort')) === '') { + $sortDir = 'ASC'; + } + + $result = $this->repository->listForAdmin( + $listRequest['filters'], + $listRequest['sortColumn'], + $sortDir, + $listRequest['page'], + $listRequest['perPage'] + ); + + $rows = []; + $lp = ($listRequest['page'] - 1) * $listRequest['perPage'] + 1; + foreach ($result['items'] as $item) { + $id = (int)($item['id'] ?? 0); + $name = trim((string)($item['name'] ?? '')); + $status = (int)($item['status'] ?? 0); + $used = (int)($item['used'] ?? 0); + $send = (int)($item['send'] ?? 0); + $oneTime = (int)($item['one_time'] ?? 0); + $type = (int)($item['type'] ?? 0); + $amount = (string)($item['amount'] ?? ''); + $dateUsed = trim((string)($item['date_used'] ?? '')); + + $rows[] = [ + 'lp' => $lp++ . '.', + 'status' => $status === 1 ? 'tak' : 'nie', + 'used_count' => (int)($item['used_count'] ?? 0), + 'name' => '' . htmlspecialchars($name, ENT_QUOTES, 'UTF-8') . '', + 'type' => htmlspecialchars((string)($type === 1 ? 'Rabat procentowy na koszyk' : '-'), ENT_QUOTES, 'UTF-8'), + 'amount' => $type === 1 && $amount !== '' ? htmlspecialchars($amount, ENT_QUOTES, 'UTF-8') . '%' : '-', + 'one_time' => $oneTime === 1 ? 'tak' : 'nie', + 'send' => $send === 1 ? 'tak' : 'nie', + 'used' => $used === 1 ? 'tak' : 'nie', + 'date_used' => $dateUsed !== '' ? htmlspecialchars($dateUsed, ENT_QUOTES, 'UTF-8') : '-', + '_actions' => [ + [ + 'label' => 'Edytuj', + 'url' => '/admin/shop_coupon/edit/id=' . $id, + 'class' => 'btn btn-xs btn-primary', + ], + [ + 'label' => 'Usun', + 'url' => '/admin/shop_coupon/delete/id=' . $id, + 'class' => 'btn btn-xs btn-danger', + 'confirm' => 'Na pewno chcesz usunac wybrany kupon?', + 'confirm_ok' => 'Usun', + 'confirm_cancel' => 'Anuluj', + ], + ], + ]; + } + + $total = (int)$result['total']; + $totalPages = max(1, (int)ceil($total / $listRequest['perPage'])); + + $viewModel = new PaginatedTableViewModel( + [ + ['key' => 'lp', 'label' => 'Lp.', 'class' => 'text-center', 'sortable' => false], + ['key' => 'status', 'sort_key' => 'status', 'label' => 'Aktywny', 'class' => 'text-center', 'sortable' => true, 'raw' => true], + ['key' => 'used_count', 'sort_key' => 'used_count', 'label' => 'Uzyto X razy', 'class' => 'text-center', 'sortable' => true], + ['key' => 'name', 'sort_key' => 'name', 'label' => 'Nazwa', 'sortable' => true, 'raw' => true], + ['key' => 'type', 'sort_key' => 'type', 'label' => 'Typ kuponu', 'sortable' => true], + ['key' => 'amount', 'sort_key' => 'amount', 'label' => 'Wartosc', 'class' => 'text-center', 'sortable' => true, 'raw' => true], + ['key' => 'one_time', 'sort_key' => 'one_time', 'label' => 'Kupon jednorazowy', 'class' => 'text-center', 'sortable' => true], + ['key' => 'send', 'sort_key' => 'send', 'label' => 'Wyslany', 'class' => 'text-center', 'sortable' => true], + ['key' => 'used', 'sort_key' => 'used', 'label' => 'Uzyty', 'class' => 'text-center', 'sortable' => true], + ['key' => 'date_used', 'sort_key' => 'date_used', 'label' => 'Data uzycia', 'class' => 'text-center', 'sortable' => true, 'raw' => true], + ], + $rows, + $listRequest['viewFilters'], + [ + 'column' => $listRequest['sortColumn'], + 'dir' => $sortDir, + ], + [ + 'page' => $listRequest['page'], + 'per_page' => $listRequest['perPage'], + 'total' => $total, + 'total_pages' => $totalPages, + ], + array_merge($listRequest['queryFilters'], [ + 'sort' => $listRequest['sortColumn'], + 'dir' => $sortDir, + 'per_page' => $listRequest['perPage'], + ]), + $listRequest['perPageOptions'], + $sortableColumns, + '/admin/shop_coupon/list/', + 'Brak danych w tabeli.', + '/admin/shop_coupon/edit/', + 'Dodaj kupon' + ); + + return \Tpl::view('shop-coupon/coupons-list', [ + 'viewModel' => $viewModel, + ]); + } + + public function view_list(): string + { + return $this->list(); + } + + public function edit(): string + { + $coupon = $this->repository->find((int)\S::get('id')); + $categories = $this->repository->categoriesTree(null); + + return \Tpl::view('shop-coupon/coupon-edit-new', [ + 'form' => $this->buildFormViewModel($coupon, $categories), + ]); + } + + public function coupon_edit(): string + { + return $this->edit(); + } + + public function save(): void + { + $legacyValues = \S::get('values'); + + if ($legacyValues) { + $values = json_decode((string)$legacyValues, true); + $response = [ + 'status' => 'error', + 'msg' => 'Podczas zapisywania kuponu wystapil blad. Prosze sprobowac ponownie.', + ]; + + if (is_array($values)) { + $id = $this->repository->save($values); + if (!empty($id)) { + $response = [ + 'status' => 'ok', + 'msg' => 'Kupon zostal zapisany.', + 'id' => (int)$id, + ]; + } + } + + echo json_encode($response); + exit; + } + + $payload = $_POST; + if (empty($payload['id'])) { + $routeId = (int)\S::get('id'); + if ($routeId > 0) { + $payload['id'] = $routeId; + } + } + + $id = $this->repository->save($payload); + if (!empty($id)) { + echo json_encode([ + 'success' => true, + 'id' => (int)$id, + 'message' => 'Kupon zostal zapisany.', + ]); + exit; + } + + echo json_encode([ + 'success' => false, + 'errors' => ['general' => 'Podczas zapisywania kuponu wystapil blad.'], + ]); + exit; + } + + public function coupon_save(): void + { + $this->save(); + } + + public function delete(): void + { + if ($this->repository->delete((int)\S::get('id'))) { + \S::alert('Kupon zostal usuniety.'); + } + + header('Location: /admin/shop_coupon/list/'); + exit; + } + + public function coupon_delete(): void + { + $this->delete(); + } + + private function buildFormViewModel(array $coupon, array $categories): FormEditViewModel + { + $id = (int)($coupon['id'] ?? 0); + $isNew = $id <= 0; + + $data = [ + 'id' => $id, + 'name' => (string)($coupon['name'] ?? ''), + 'send' => (int)($coupon['send'] ?? 0), + 'status' => (int)($coupon['status'] ?? 1), + 'used' => (int)($coupon['used'] ?? 0), + 'type' => (int)($coupon['type'] ?? 1), + 'amount' => (string)($coupon['amount'] ?? ''), + 'one_time' => (int)($coupon['one_time'] ?? 1), + 'include_discounted_product' => (int)($coupon['include_discounted_product'] ?? 0), + ]; + + $fields = [ + FormField::hidden('id', $id), + FormField::text('name', [ + 'label' => 'Nazwa', + 'tab' => 'settings', + 'required' => true, + ]), + FormField::switch('send', [ + 'label' => 'Wyslany', + 'tab' => 'settings', + ]), + FormField::switch('status', [ + 'label' => 'Aktywny', + 'tab' => 'settings', + 'value' => true, + ]), + FormField::switch('used', [ + 'label' => 'Uzyty', + 'tab' => 'settings', + ]), + FormField::select('type', [ + 'label' => 'Typ kuponu', + 'tab' => 'settings', + 'options' => [ + 1 => 'Rabat procentowy na koszyk', + ], + 'required' => true, + ]), + FormField::text('amount', [ + 'label' => 'Wartosc', + 'tab' => 'settings', + 'attributes' => ['class' => 'number-format'], + ]), + FormField::switch('one_time', [ + 'label' => 'Kupon jednorazowy', + 'tab' => 'settings', + 'value' => true, + ]), + FormField::switch('include_discounted_product', [ + 'label' => 'Dotyczy rowniez produktow przecenionych', + 'tab' => 'settings', + ]), + FormField::custom('coupon_categories', \Tpl::view('shop-coupon/coupon-categories-selector', [ + 'label' => 'Ogranicz promocje do wybranych kategorii', + 'inputName' => 'categories[]', + 'categories' => $categories, + 'selectedIds' => is_array($coupon['categories'] ?? null) ? $coupon['categories'] : [], + ]), [ + 'tab' => 'categories', + ]), + ]; + + $tabs = [ + new FormTab('settings', 'Ustawienia', 'fa-wrench'), + new FormTab('categories', 'Kategorie', 'fa-folder-open'), + ]; + + $actionUrl = '/admin/shop_coupon/save/' . ($isNew ? '' : ('id=' . $id)); + $actions = [ + FormAction::save($actionUrl, '/admin/shop_coupon/list/'), + FormAction::cancel('/admin/shop_coupon/list/'), + ]; + + return new FormEditViewModel( + 'shop-coupon-edit', + $isNew ? 'Nowy kupon' : ('Edycja kuponu: ' . (string)($coupon['name'] ?? '')), + $data, + $fields, + $tabs, + $actions, + 'POST', + $actionUrl, + '/admin/shop_coupon/list/', + true, + ['id' => $id] + ); + } +} diff --git a/autoload/admin/class.Site.php b/autoload/admin/class.Site.php index 2cb0584..23b4371 100644 --- a/autoload/admin/class.Site.php +++ b/autoload/admin/class.Site.php @@ -309,6 +309,13 @@ class Site new \Domain\Promotion\PromotionRepository( $mdb ) ); }, + 'ShopCoupon' => function() { + global $mdb; + + return new \admin\Controllers\ShopCouponController( + new \Domain\Coupon\CouponRepository( $mdb ) + ); + }, 'Pages' => function() { global $mdb; diff --git a/autoload/admin/controls/class.ShopCoupon.php b/autoload/admin/controls/class.ShopCoupon.php deleted file mode 100644 index 2ce1ea2..0000000 --- a/autoload/admin/controls/class.ShopCoupon.php +++ /dev/null @@ -1,58 +0,0 @@ - delete() ) - \S::alert( 'Kupon został usunięty.' ); - header( 'Location: /admin/shop_coupon/view_list/' ); - exit; - } - - public static function coupon_save() - { - $response = ['status' => 'error', 'msg' => 'Podczas zapisywania kuponu wystąpił błąd. Proszę spróbować ponownie.']; - $values = json_decode( \S::get( 'values' ), true ); - - if ( $values['categories'] != null ) - $categories = is_array( $values['categories'] ) ? json_encode( $values['categories'] ) : json_encode( [ $values['categories'] ] ); - else - $categories = null; - - if ( \admin\factory\ShopCoupon::save( - $values['id'], - $values['name'], - $values['status'] == 'on' ? 1 : 0, - $values['send'] == 'on' ? 1 : 0, - $values['used'] == 'on' ? 1 : 0, - $values['type'], - $values['amount'], - $values['one_time'] == 'on' ? 1 : 0, - $values['include_discounted_product'] == 'on' ? 1 : 0, - $categories - ) - ) - $response = [ 'status' => 'ok', 'msg' => 'Kupon został zapisany.', 'id' => $values['id'] ]; - - echo json_encode( $response ); - exit; - } - - public static function coupon_edit() - { - return \Tpl::view( 'shop-coupon/coupon-edit', [ - 'coupon' => \admin\factory\ShopCoupon::details( (int)\S::get( 'id' ) ), - 'categories' => \admin\factory\ShopCategory::subcategories( null ), - 'dlang' => \front\factory\Languages::default_language() - ] ); - } - - public static function view_list() - { - return \Tpl::view( 'shop-coupon/view-list' ); - } - -} \ No newline at end of file diff --git a/autoload/admin/factory/class.ShopCoupon.php b/autoload/admin/factory/class.ShopCoupon.php deleted file mode 100644 index 6ba8266..0000000 --- a/autoload/admin/factory/class.ShopCoupon.php +++ /dev/null @@ -1,54 +0,0 @@ - get( 'pp_shop_coupon', '*', [ 'id' => $coupon_id ] ); - } - - public static function coupon_delete( $coupon_id ) - { - global $mdb; - return $mdb -> delete( 'pp_shop_coupon', [ 'id' => $coupon_id ] ); - } - - public static function save( $coupon_id, $name, $status, $send, $used, $type, $amount, $one_time, $include_discounted_product, $categories ) - { - global $mdb; - - if ( !$coupon_id ) - { - if ( $mdb -> insert( 'pp_shop_coupon', [ - 'name' => $name, - 'status' => $status, - 'used' => $used, - 'type' => $type, - 'amount' => $amount, - 'one_time' => $one_time, - 'send' => $send, - 'include_discounted_product' => $include_discounted_product, - 'categories' => $categories - ] ) ) - return $mdb -> id(); - } - else - { - $mdb -> update( 'pp_shop_coupon', [ - 'name' => $name, - 'status' => $status, - 'used' => $used, - 'type' => $type, - 'amount' => $amount, - 'one_time' => $one_time, - 'send' => $send, - 'include_discounted_product' => $include_discounted_product, - 'categories' => $categories - ], [ - 'id' => $coupon_id - ] ); - return true; - } - } -} diff --git a/index.php b/index.php index 6e4dd8f..22ef03d 100644 --- a/index.php +++ b/index.php @@ -136,6 +136,17 @@ if ( \S::get( 'a' ) == 'page' and \S::get( 'id' ) ) \S::set_session( 'page', $page ); } +if ( !is_array( $page ) or !(int)$page['id'] ) +{ + $page = \S::get_session( 'page' ); +} + +if ( !is_array( $page ) or !(int)$page['id'] ) +{ + $page = \front\factory\Pages::page_details(); + \S::set_session( 'page', $page ); +} + if ( \S::get( 'devel' ) ) $settings[ 'devel' ] = true; @@ -350,4 +361,4 @@ if ( file_exists( 'plugins/special-actions-end.php' ) ) include 'plugins/special-actions-end.php'; echo $html; -?> \ No newline at end of file +?> diff --git a/tests/Unit/Domain/Coupon/CouponRepositoryTest.php b/tests/Unit/Domain/Coupon/CouponRepositoryTest.php new file mode 100644 index 0000000..b0fe639 --- /dev/null +++ b/tests/Unit/Domain/Coupon/CouponRepositoryTest.php @@ -0,0 +1,268 @@ +createMock(\medoo::class); + $repository = new CouponRepository($mockDb); + + $result = $repository->find(0); + + $this->assertIsArray($result); + $this->assertSame(0, (int)$result['id']); + $this->assertSame(1, (int)$result['status']); + $this->assertSame(1, (int)$result['one_time']); + $this->assertSame([], $result['categories']); + } + + public function testFindNormalizesCouponData(): void + { + $mockDb = $this->createMock(\medoo::class); + $mockDb->expects($this->once()) + ->method('get') + ->with('pp_shop_coupon', '*', ['id' => 15]) + ->willReturn([ + 'id' => '15', + 'name' => 'KOD15', + 'status' => '1', + 'send' => 0, + 'used' => '1', + 'type' => '1', + 'amount' => '15.00', + 'one_time' => '0', + 'include_discounted_product' => '1', + 'categories' => '[4,6,6]', + 'used_count' => '3', + ]); + + $repository = new CouponRepository($mockDb); + $result = $repository->find(15); + + $this->assertSame(15, (int)$result['id']); + $this->assertSame(1, (int)$result['status']); + $this->assertSame(0, (int)$result['send']); + $this->assertSame(1, (int)$result['used']); + $this->assertSame(0, (int)$result['one_time']); + $this->assertSame(1, (int)$result['include_discounted_product']); + $this->assertSame([4, 6], $result['categories']); + $this->assertSame(3, (int)$result['used_count']); + } + + public function testSaveInsertsCouponAndReturnsId(): void + { + $mockDb = $this->createMock(\medoo::class); + $insertRow = null; + + $mockDb->expects($this->once()) + ->method('insert') + ->willReturnCallback(function ($table, $row) use (&$insertRow) { + $this->assertSame('pp_shop_coupon', $table); + $insertRow = $row; + }); + + $mockDb->expects($this->once()) + ->method('id') + ->willReturn(321); + + $repository = new CouponRepository($mockDb); + $id = $repository->save([ + 'name' => ' KOD25 ', + 'status' => 'on', + 'send' => '1', + 'used' => 0, + 'type' => 1, + 'amount' => '25,50', + 'one_time' => 'on', + 'include_discounted_product' => 'on', + 'categories' => [1, '2', 'abc', 2], + ]); + + $this->assertSame(321, $id); + $this->assertIsArray($insertRow); + $this->assertSame('KOD25', $insertRow['name'] ?? ''); + $this->assertSame(1, (int)($insertRow['status'] ?? 0)); + $this->assertSame(1, (int)($insertRow['send'] ?? 0)); + $this->assertSame(0, (int)($insertRow['used'] ?? 1)); + $this->assertSame('25.50', $insertRow['amount'] ?? null); + $this->assertSame('[1,2]', $insertRow['categories'] ?? null); + } + + public function testSaveUpdatesCouponAndReturnsId(): void + { + $mockDb = $this->createMock(\medoo::class); + $updateRow = null; + $updateWhere = null; + + $mockDb->expects($this->once()) + ->method('update') + ->willReturnCallback(function ($table, $row, $where) use (&$updateRow, &$updateWhere) { + $this->assertSame('pp_shop_coupon', $table); + $updateRow = $row; + $updateWhere = $where; + return true; + }); + + $mockDb->expects($this->never())->method('insert'); + $mockDb->expects($this->never())->method('id'); + + $repository = new CouponRepository($mockDb); + $id = $repository->save([ + 'id' => 77, + 'name' => 'KOD77', + 'status' => '0', + 'send' => 'off', + 'used' => '0', + 'type' => 1, + 'amount' => '', + 'one_time' => '0', + 'include_discounted_product' => 0, + 'categories' => '', + ]); + + $this->assertSame(77, $id); + $this->assertIsArray($updateRow); + $this->assertArrayHasKey('amount', $updateRow); + $this->assertArrayHasKey('categories', $updateRow); + $this->assertNull($updateRow['amount']); + $this->assertNull($updateRow['categories']); + $this->assertSame(0, (int)($updateRow['status'] ?? 1)); + $this->assertSame(['id' => 77], $updateWhere); + } + + public function testDeleteReturnsFalseForInvalidId(): void + { + $mockDb = $this->createMock(\medoo::class); + $mockDb->expects($this->never())->method('delete'); + + $repository = new CouponRepository($mockDb); + $this->assertFalse($repository->delete(0)); + } + + public function testDeleteReturnsTrueWhenDatabaseDeleteSucceeds(): void + { + $mockDb = $this->createMock(\medoo::class); + $mockDb->expects($this->once()) + ->method('delete') + ->with('pp_shop_coupon', ['id' => 55]) + ->willReturn(true); + + $repository = new CouponRepository($mockDb); + $this->assertTrue($repository->delete(55)); + } + + public function testListForAdminWhitelistsSortAndDirection(): void + { + $mockDb = $this->createMock(\medoo::class); + $queries = []; + + $mockDb->method('query') + ->willReturnCallback(function ($sql, $params = []) use (&$queries) { + $queries[] = ['sql' => $sql, 'params' => $params]; + + if (strpos($sql, 'COUNT(0)') !== false) { + return new class { + public function fetchAll() + { + return [[1]]; + } + }; + } + + return new class { + public function fetchAll() + { + return [[ + 'id' => 1, + 'name' => 'KOD', + 'status' => 1, + 'used' => 0, + 'type' => 1, + 'amount' => '10', + 'one_time' => 1, + 'send' => 0, + 'include_discounted_product' => 0, + 'categories' => '[3,5]', + 'date_used' => null, + 'used_count' => 7, + ]]; + } + }; + }); + + $repository = new CouponRepository($mockDb); + $result = $repository->listForAdmin( + [], + 'date_used DESC; DROP TABLE pp_shop_coupon; --', + 'DESC; DELETE FROM pp_users; --', + 1, + 999 + ); + + $this->assertCount(2, $queries); + $dataSql = $queries[1]['sql']; + + $this->assertMatchesRegularExpression('/ORDER BY\s+sc\.name\s+ASC,\s+sc\.id\s+DESC/i', $dataSql); + $this->assertStringNotContainsString('DROP TABLE', $dataSql); + $this->assertStringNotContainsString('DELETE FROM pp_users', $dataSql); + $this->assertMatchesRegularExpression('/LIMIT\s+100\s+OFFSET\s+0/i', $dataSql); + + $this->assertSame([3, 5], $result['items'][0]['categories']); + } + + public function testCategoriesTreeReturnsHierarchy(): void + { + $mockDb = $this->createMock(\medoo::class); + + $mockDb->method('select') + ->willReturnCallback(function ($table, $columns, $where) { + if ($table === 'pp_shop_categories' && array_key_exists('parent_id', $where)) { + if ($where['parent_id'] === null) { + return [['id' => 10]]; + } + if ((int)$where['parent_id'] === 10) { + return [['id' => 11]]; + } + return []; + } + + if ($table === 'pp_shop_categories_langs') { + if ((int)$where['category_id'] === 10) { + return [['lang_id' => 'pl', 'title' => 'Kategoria A']]; + } + if ((int)$where['category_id'] === 11) { + return [['lang_id' => 'pl', 'title' => 'Podkategoria A1']]; + } + return []; + } + + if ($table === 'pp_langs') { + return [['id' => 'pl', 'start' => 1, 'o' => 1]]; + } + + return []; + }); + + $mockDb->method('get') + ->willReturnCallback(function ($table, $columns, $where) { + if ($table === 'pp_shop_categories') { + $id = (int)$where['id']; + return ['id' => $id, 'status' => 1]; + } + return null; + }); + + $repository = new CouponRepository($mockDb); + $tree = $repository->categoriesTree(null); + + $this->assertCount(1, $tree); + $this->assertSame(10, (int)$tree[0]['id']); + $this->assertSame('Kategoria A', $tree[0]['title']); + $this->assertCount(1, $tree[0]['subcategories']); + $this->assertSame(11, (int)$tree[0]['subcategories'][0]['id']); + } +} diff --git a/tests/Unit/admin/Controllers/ShopCouponControllerTest.php b/tests/Unit/admin/Controllers/ShopCouponControllerTest.php new file mode 100644 index 0000000..edf1adf --- /dev/null +++ b/tests/Unit/admin/Controllers/ShopCouponControllerTest.php @@ -0,0 +1,65 @@ +repository = $this->createMock(CouponRepository::class); + $this->controller = new ShopCouponController($this->repository); + } + + public function testConstructorAcceptsRepository(): void + { + $controller = new ShopCouponController($this->repository); + $this->assertInstanceOf(ShopCouponController::class, $controller); + } + + public function testHasMainActionMethods(): void + { + $this->assertTrue(method_exists($this->controller, 'list')); + $this->assertTrue(method_exists($this->controller, 'edit')); + $this->assertTrue(method_exists($this->controller, 'save')); + $this->assertTrue(method_exists($this->controller, 'delete')); + } + + public function testHasLegacyAliasMethods(): void + { + $this->assertTrue(method_exists($this->controller, 'view_list')); + $this->assertTrue(method_exists($this->controller, 'coupon_edit')); + $this->assertTrue(method_exists($this->controller, 'coupon_save')); + $this->assertTrue(method_exists($this->controller, 'coupon_delete')); + } + + public function testActionMethodReturnTypes(): void + { + $reflection = new \ReflectionClass($this->controller); + + $this->assertEquals('string', (string)$reflection->getMethod('list')->getReturnType()); + $this->assertEquals('string', (string)$reflection->getMethod('view_list')->getReturnType()); + $this->assertEquals('string', (string)$reflection->getMethod('edit')->getReturnType()); + $this->assertEquals('string', (string)$reflection->getMethod('coupon_edit')->getReturnType()); + $this->assertEquals('void', (string)$reflection->getMethod('save')->getReturnType()); + $this->assertEquals('void', (string)$reflection->getMethod('coupon_save')->getReturnType()); + $this->assertEquals('void', (string)$reflection->getMethod('delete')->getReturnType()); + $this->assertEquals('void', (string)$reflection->getMethod('coupon_delete')->getReturnType()); + } + + public function testConstructorRequiresCouponRepository(): void + { + $reflection = new \ReflectionClass(ShopCouponController::class); + $constructor = $reflection->getConstructor(); + $params = $constructor->getParameters(); + + $this->assertCount(1, $params); + $this->assertEquals('Domain\Coupon\CouponRepository', $params[0]->getType()->getName()); + } +} + diff --git a/updates/0.20/ver_0.266.zip b/updates/0.20/ver_0.266.zip new file mode 100644 index 0000000..ea974f8 Binary files /dev/null and b/updates/0.20/ver_0.266.zip differ diff --git a/updates/0.20/ver_0.266_files.txt b/updates/0.20/ver_0.266_files.txt new file mode 100644 index 0000000..c6332c2 --- /dev/null +++ b/updates/0.20/ver_0.266_files.txt @@ -0,0 +1,4 @@ +F: ../admin/templates/shop-coupon/coupon-edit.php +F: ../admin/templates/shop-coupon/view-list.php +F: ../autoload/admin/controls/class.ShopCoupon.php +F: ../autoload/admin/factory/class.ShopCoupon.php diff --git a/updates/changelog.php b/updates/changelog.php index 8d248a0..e2098d7 100644 --- a/updates/changelog.php +++ b/updates/changelog.php @@ -1,3 +1,14 @@ +ver. 0.266 - 13.02.2026
    +- NEW - migracja modulu `ShopCoupon` do architektury Domain + DI (`Domain\Coupon\CouponRepository`, `admin\Controllers\ShopCouponController`) +- UPDATE - modul `/admin/shop_coupon/*` przepiety z legacy `grid/gridEdit` na `components/table-list` i `components/form-edit` +- UPDATE - nowe widoki i partiale: `shop-coupon/coupons-list`, `shop-coupon/coupon-edit-new`, `shop-coupon/coupon-categories-selector`, `shop-coupon/coupon-categories-tree`, `shop-coupon/coupon-edit-custom-script` +- UPDATE - zachowana kompatybilnosc aliasow legacy akcji (`view_list`, `coupon_edit`, `coupon_save`, `coupon_delete`) w nowym kontrolerze +- CLEANUP - usuniete legacy klasy/pliki: `autoload/admin/controls/class.ShopCoupon.php`, `autoload/admin/factory/class.ShopCoupon.php`, `admin/templates/shop-coupon/view-list.php`, `admin/templates/shop-coupon/coupon-edit.php` +- UPDATE - menu admin wskazuje kanoniczny URL `/admin/shop_coupon/list/` +- FIX - ujednolicone drzewka (strzalki + focus) i wyglad checkboxow miedzy `/admin/shop_coupon/edit/*` oraz `/admin/layouts/edit/*` +- UPDATE - testy: `OK (235 tests, 682 assertions)` + nowe pliki testowe `CouponRepositoryTest`, `ShopCouponControllerTest` +- UPDATE - pliki aktualizacji: `updates/0.20/ver_0.266.zip`, `ver_0.266_files.txt` +
    ver. 0.265 - 13.02.2026
    - UPDATE - modul `/admin/shop_promotion/*`: dodano pole `Data od` (`date_from`) w repozytorium, formularzu i liscie - UPDATE - front: `shop\Promotion::get_active_promotions()` uwzglednia `date_from` (okno aktywnosci od-do) @@ -452,6 +463,3 @@ - - - diff --git a/updates/versions.php b/updates/versions.php index bb1f9e4..3221827 100644 --- a/updates/versions.php +++ b/updates/versions.php @@ -1,5 +1,5 @@