Two domains, one MT3S bundle: Marketing Programs (unchanged) and the
imported Smart Links (smart links + UTM taxonomies), each keeping its
own menu, tables, routes and translations.
- Code moved from MauticPlugin\SmartlinksBundle\ to
MauticPlugin\MT3SMarketingProgramBundle\; template namespace
@Smartlinks/ -> @MT3SMarketingProgram/; smartlinks.js ->
Assets/js/mt3s-mp-smartlinks.js; icon -> Assets/img/smartlinks-icon.svg.
- Incoming migrations renamed Version_0_X_0_SmartLinks.php to avoid
the class-name collision; schema untouched, data intact.
- Permissions folded into MT3SMarketingProgramPermissions:
smart_links + taxonomies under the mt3smarketingprogram: base
(roles that had the old smartlinks: grants must be re-granted).
- config.php: Smart Links routes + menu group, public /l/{slug},
SmartlinksIntegration services, smartlinks_* parameters (legacy
utm_manager_* keys still readable), version 0.18.0. The 0.17.0
placeholder /s/marketing-program-utm-taxonomies is replaced by the
real /s/utm-taxonomies.
- Translations merged (en_US) and added (fr_FR); Tests/ + phpunit moved
in; readme documents both domains and the 0.18.0 merge history.
Verified live: menus, both config tabs, both lists + forms, program
pages, public redirect with taxonomy UTM values, host + unknown-slug
404s, 90/90 unit tests, full php -l, all ini catalogs parse.
67 lines
2.4 KiB
PHP
67 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MauticPlugin\MT3SMarketingProgramBundle\Tests\Unit\Model;
|
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use Mautic\CoreBundle\Helper\CoreParametersHelper;
|
|
use Mautic\CoreBundle\Helper\UserHelper;
|
|
use Mautic\CoreBundle\Security\Permissions\CorePermissions;
|
|
use MauticPlugin\MT3SMarketingProgramBundle\Model\UtmTaxonomyModel;
|
|
use PHPUnit\Framework\TestCase;
|
|
use Psr\Log\LoggerInterface;
|
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
|
|
final class UtmTaxonomyModelTest extends TestCase
|
|
{
|
|
private function createModel(): UtmTaxonomyModel
|
|
{
|
|
return new UtmTaxonomyModel(
|
|
$this->createMock(EntityManagerInterface::class),
|
|
$this->createMock(CorePermissions::class),
|
|
$this->createMock(EventDispatcherInterface::class),
|
|
$this->createMock(UrlGeneratorInterface::class),
|
|
$this->createMock(TranslatorInterface::class),
|
|
$this->createMock(UserHelper::class),
|
|
$this->createMock(LoggerInterface::class),
|
|
$this->createMock(CoreParametersHelper::class)
|
|
);
|
|
}
|
|
|
|
public function testNormalizeParametersTrimsDeduplicatesSortsAndFallsBackToTheValueAsLabel(): void
|
|
{
|
|
$clean = $this->createModel()->normalizeParameters([
|
|
'utm_source' => [
|
|
['value' => ' newsletter ', 'label' => 'Newsletter'],
|
|
['value' => 'newsletter', 'label' => 'Duplicate value, dropped'],
|
|
['value' => '', 'label' => 'Empty value, dropped'],
|
|
'not-an-array',
|
|
],
|
|
'utm_campaign' => [
|
|
['value' => 'spring', 'label' => ''],
|
|
],
|
|
' ' => [['value' => 'x', 'label' => 'X']],
|
|
'not-an-array' => 'nope',
|
|
]);
|
|
|
|
$this->assertSame([
|
|
'utm_campaign' => [
|
|
['value' => 'spring', 'label' => 'spring'],
|
|
],
|
|
'utm_source' => [
|
|
['value' => 'newsletter', 'label' => 'Newsletter'],
|
|
],
|
|
], $clean);
|
|
}
|
|
|
|
public function testNormalizeParametersDropsParametersWithoutValues(): void
|
|
{
|
|
$this->assertSame([], $this->createModel()->normalizeParameters([
|
|
'utm_source' => [['value' => '', 'label' => 'Empty']],
|
|
'gclid' => [],
|
|
]));
|
|
}
|
|
} |