File size: 2,746 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php

declare(strict_types=1);

namespace Mautic\ReportBundle\Tests\Helper;

use Mautic\ReportBundle\Helper\ReportHelper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

final class ReportHelperTest extends TestCase
{
    private ReportHelper $reportHelper;

    protected function setUp(): void
    {
        $this->reportHelper = new ReportHelper($this->createMock(EventDispatcherInterface::class));
    }

    public function testGetStandardColumnsMethodReturnsCorrectColumns(): void
    {
        $columns = $this->reportHelper->getStandardColumns('somePrefix');

        $expectedColumnns = [
            'somePrefixid' => [
                'label' => 'mautic.core.id',
                'type'  => 'int',
                'alias' => 'somePrefixid',
            ],
            'somePrefixname' => [
                'label' => 'mautic.core.name',
                'type'  => 'string',
                'alias' => 'somePrefixname',
            ],
            'somePrefixcreated_by_user' => [
                'label' => 'mautic.core.createdby',
                'type'  => 'string',
                'alias' => 'somePrefixcreated_by_user',
            ],
            'somePrefixdate_added' => [
                'label' => 'mautic.report.field.date_added',
                'type'  => 'datetime',
                'alias' => 'somePrefixdate_added',
            ],
            'somePrefixmodified_by_user' => [
                'label' => 'mautic.report.field.modified_by_user',
                'type'  => 'string',
                'alias' => 'somePrefixmodified_by_user',
            ],
            'somePrefixdate_modified' => [
                'label' => 'mautic.report.field.date_modified',
                'type'  => 'datetime',
                'alias' => 'somePrefixdate_modified',
            ],
            'somePrefixdescription' => [
                'label' => 'mautic.core.description',
                'type'  => 'string',
                'alias' => 'somePrefixdescription',
            ],
            'somePrefixpublish_up' => [
                'label' => 'mautic.report.field.publish_up',
                'type'  => 'datetime',
                'alias' => 'somePrefixpublish_up',
            ],
            'somePrefixpublish_down' => [
                'label' => 'mautic.report.field.publish_down',
                'type'  => 'datetime',
                'alias' => 'somePrefixpublish_down',
            ],
            'somePrefixis_published' => [
                'label' => 'mautic.report.field.is_published',
                'type'  => 'bool',
                'alias' => 'somePrefixis_published',
            ],
        ];

        $this->assertEquals($expectedColumnns, $columns);
    }
}