forked from mautic/mautic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: Custom Point Action triggering and form mautic#13868 (mautic#14218)
* TASK: Removes `GenericPointSettingsType` from ajax call * TASK: Removes GenericPointSettingsType * FIX: Makes PointBundle `EventHelper` use the right array item to access points * FIX: Sets initiated state * TASK: Adds test * FIX: phpstan * TASK: Re-creates `GenericPointSettingsType.php` for semver and adds depreciation notice
- Loading branch information
1 parent
6a11649
commit fde2585
Showing
6 changed files
with
47 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/bundles/PointBundle/Tests/Unit/Helper/EventHelperTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mautic\PointBundle\Tests\Unit\Helper; | ||
|
||
use Mautic\LeadBundle\Entity\Lead; | ||
use Mautic\PointBundle\Helper\EventHelper; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class EventHelperTest extends TestCase | ||
{ | ||
public function testEngagePointAction(): void | ||
{ | ||
$lead = new Lead(); | ||
|
||
// Define the action array | ||
$action = ['id' => 1, 'type' => 'helloworld.action.custom_action', 'name' => 'My custom point action', 'properties' => [], 'points' => 50]; | ||
|
||
$points = EventHelper::engagePointAction($lead, $action); | ||
$this->assertEquals(50, $points); | ||
|
||
$points = EventHelper::engagePointAction($lead, $action); | ||
$this->assertEquals(0, $points, 'Second call should return 0 points because the action is already initiated for this lead and type and session.'); | ||
} | ||
} |