File size: 1,436 Bytes
d2897cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

declare(strict_types=1);

namespace Mautic\LeadBundle\Tests\Controller;

use Mautic\CoreBundle\Test\MauticMysqlTestCase;
use Mautic\CoreBundle\Tests\Functional\CreateTestEntitiesTrait;
use Symfony\Component\HttpFoundation\Response;

final class TimelineControllerTest extends MauticMysqlTestCase
{
    use CreateTestEntitiesTrait;

    public function testIndexActionsIsSuccessful(): void
    {
        $contact = $this->createLead('TestFirstName');
        $this->em->flush();

        $crawler = $this->client->request('GET', '/s/contacts/timeline/'.$contact->getId());
        $this->assertEquals(Response::HTTP_OK, $this->client->getResponse()->getStatusCode());
    }

    public function testFilterCaseInsensitive(): void
    {
        $contact = $this->createLead('TestFirstName');
        $segment = $this->createSegment('TEST', []);
        $this->createListLead($segment, $contact);
        $this->em->flush();
        $this->createLeadEventLogEntry($contact, 'lead', 'segment', 'added', $segment->getId(), [
            'object_description' => $segment->getName(),
        ]);
        $this->em->flush();

        $crawler = $this->client->request('POST', '/s/contacts/timeline/'.$contact->getId(), [
            'search' => 'test',
            'leadId' => $contact->getId(),
        ]);

        $this->assertStringContainsString('Contact added to segment, TEST', $this->client->getResponse()->getContent());
    }
}