Skip to content

Commit

Permalink
Add TU
Browse files Browse the repository at this point in the history
  • Loading branch information
Enc3phale committed Sep 6, 2019
1 parent ba643ac commit 26273fb
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,34 @@ public function testGetParameterValue()

$this->assertEquals('%-03-02', $filterDecorator->getParameterValue($contactSegmentFilterCrate));
}

/**
* @covers \Mautic\LeadBundle\Segment\Decorator\Date\Other\DateAnniversary::getParameterValue
*/
public function testGetParameterValueWithRelativeDate()
{
$dateDecorator = $this->createMock(DateDecorator::class);
$timezoneResolver = $this->createMock(TimezoneResolver::class);

$date = new DateTimeHelper('2018-03-02', null, 'local');

$timezoneResolver->method('getDefaultDate')
->with()
->willReturn($date);

$filter = [
'operator' => '=',
];
$contactSegmentFilterCrate = new ContactSegmentFilterCrate($filter);
$dateOptionParameters = new DateOptionParameters($contactSegmentFilterCrate, [], $timezoneResolver);

$filter = [
'filter' => 'birthday +2days',
];
$contactSegmentFilterCrate = new ContactSegmentFilterCrate($filter);

$filterDecorator = new DateAnniversary($dateDecorator, $dateOptionParameters);

$this->assertEquals('%-03-04', $filterDecorator->getParameterValue($contactSegmentFilterCrate));
}
}

0 comments on commit 26273fb

Please sign in to comment.