diff --git a/tests/Fixtures/src/Model/PluginFamily/filterPluginsByActivation.php b/tests/Fixtures/src/Model/PluginFamily/filterPluginsByActivation.php index f37df58..6653a2b 100644 --- a/tests/Fixtures/src/Model/PluginFamily/filterPluginsByActivation.php +++ b/tests/Fixtures/src/Model/PluginFamily/filterPluginsByActivation.php @@ -298,6 +298,76 @@ ], ]; +$expectedWithSecondOrLastPluginActiveInCategory = [ + 'optimize_performance' => [ + 'title' => 'Optimize Performance', + 'plugins' => [ + 'imagify-plugin/imagify' => [ + 'logo' => [ + 'file' => 'logo-imagify.svg', + 'width' => '50%', + ], + 'title' => 'Speed Up Your Website With Lighter Images', + 'desc' => 'Imagify is the easiest WordPress image optimizer. It automatically compresses images, converts them to WebP and AVIF formats, and lets you resize and optimize with just one click!', + 'link' => 'https://imagify.io/', + 'cta' => [ + 'text' => 'Install', + 'url' => 'http://example.org/wp-admin/admin-post.php?action=install_imagify_from_partner_wp-rocket&_wpnonce=9a68f00b8d&_wp_http_referer=https%3A%2F%2Fexample.org%2Fwp-admin' + ], + ], + ], + ], + 'boost_traffic' => [ + 'title' => 'Boost Traffic', + 'plugins' => [ + 'seo-by-rank-math/rank-math' => [ + 'logo' => [ + 'file' => 'logo-rank-math.svg', + 'width' => '60%', + ], + 'title' => 'The Swiss Army Knife of SEO Tools', + 'desc' => 'Rank Math SEO is the Best WordPress SEO plugin with the features of many SEO and AI SEO tools in a single package to help multiply your SEO traffic.', + 'link' => 'https://rankmath.com/wordpress/plugin/seo-suite/', + 'cta' => [ + 'text' => 'Install', + 'url' => 'http://example.org/wp-admin/admin-post.php?action=plugin_family_install_seo-by-rank-math&_wpnonce=9a68f00b8d&plugin_to_install=seo-by-rank-math%2Frank-math' + ], + ], + ], + ], + 'protect_secure' => [ + 'title' => 'Protect & Secure', + 'plugins' => [ + 'backwpup/backwpup' => [ + 'logo' => [ + 'file' => 'logo-backwpup.svg', + 'width' => '60%', + ], + 'title' => 'The Easiest Way to Protect Your Website', + 'desc' => 'BackWPup is the most comprehensive and user-friendly backup & restore plugin for WordPress. Easily schedule automatic backups, securely store and restore with just a few clicks!', + 'link' => 'https://backwpup.com/', + 'cta' => [ + 'text' => 'Install', + 'url' => 'http://example.org/wp-admin/admin-post.php?action=plugin_family_install_backwpup&_wpnonce=9a68f00b8d&plugin_to_install=backwpup%2Fbackwpup' + ], + ], + 'uk-cookie-consent/uk-cookie-consent' => [ + 'logo' => [ + 'file' => 'logo-termly.svg', + 'width' => '50%', + ], + 'title' => 'GDPR/CCPA Cookie Consent Banner', + 'desc' => 'One of the easiest, most comprehensive, and popular cookie consent plugins available. Google Gold Certified Partner to quickly comply with data privacy laws from around the world.', + 'link' => 'https://termly.io/resources/articles/wordpress-cookies-guide/', + 'cta' => [ + 'text' => 'Activated', + 'url' => '#' + ], + ], + ], + ], +]; + return [ 'testShouldReturnEmptyArrayIfEmptyArrayParsed' => [ 'config' => [ @@ -344,4 +414,13 @@ ], 'expected' => $expectedUniqueInstallLinkForImagify, ], + 'testShouldReturnAsExpectedWithSecondOrLastPluginActiveInCategory' => [ + 'config' => [ + 'plugins' => $plugins, + 'main_plugin' => 'wp-rocket/wp-rocket', + 'order' => 'categorized', + 'active_plugin' => 'uk-cookie-consent/uk-cookie-consent.php', + ], + 'expected' => $expectedWithSecondOrLastPluginActiveInCategory, + ] ]; \ No newline at end of file