Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ChangesTest.php « Integration « tests « CoreHome « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c22ad03f34ea39f13be5c16b6121eedf88d471d (plain)
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
<?php
/**
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

namespace Piwik\Plugins\CoreHome\tests\Integration;

use Piwik\Tests\Fixtures\CreateChanges;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
use Piwik\Changes\Model as ChangesModel;

/**
 * @group CoreHome
 * @group CoreHomeTest
 * @group CoreHomeChanges
 */
class ChangesTest extends IntegrationTestCase
{

    /**
     * @var CreateChanges
     */
    public static $fixture;

    public function test_CoreHomeChanges_ShouldSortChangeListMostRecentFirst()
    {
        $json = '{"idchange":5,"plugin_name":"CoreHome","version":"4.6.0b5","title":"New feature x added","description":"Now you can do a with b like this","link_name":"For more information go here","link":"https:\/\/www.matomo.org"}';
        $changesModel = new ChangesModel();
        $changes = $changesModel->getChangeItems();
        $r = reset($changes);
        unset($r['created_time']);
        $this->assertEquals($json, json_encode($r, true));
    }

    public function test_CoreHomeChanges_ShouldAllowChangeItemAddWithoutLink()
    {
        $json = '{"idchange":4,"plugin_name":"CoreHome","version":"4.5.0","title":"New feature y added","description":"Now you can do c with d like this","link_name":null,"link":null}';
        $changesModel = new ChangesModel();
        $changes = $changesModel->getChangeItems();
        $r = $changes[1];
        unset($r['created_time']);
        $this->assertEquals($json, json_encode($r, true));
    }

}

ChangesTest::$fixture = new CreateChanges();