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

FixedSiteIdsTest.php « CronArchive « Core « Integration « PHPUnit « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 259df6fc9e247be6d63410f533313f40a698db64 (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
51
52
53
54
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

use Piwik\CronArchive\FixedSiteIds;

/**
 * @group Core
 */
class FixedSiteIdsTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var FixedSiteIds
     */
    private $fixedSiteIds;

    public function setUp()
    {
        $this->fixedSiteIds = new FixedSiteIds(array(1,2,5,9));
    }

    public function test_construct_withEmptyValue()
    {
        $siteIds = new FixedSiteIds(null);
        $this->assertEquals(0, $siteIds->getNumSites());
        $this->assertNull($siteIds->getNextSiteId());
    }

    public function test_getNumSites()
    {
        $this->assertEquals(4, $this->fixedSiteIds->getNumSites());
    }

    public function test_getNumProcessedWebsites_getNextSiteId()
    {
        $this->assertEquals(0, $this->fixedSiteIds->getNumProcessedWebsites());
        $this->assertEquals(1, $this->fixedSiteIds->getNextSiteId());
        $this->assertEquals(1, $this->fixedSiteIds->getNumProcessedWebsites());
        $this->assertEquals(2, $this->fixedSiteIds->getNextSiteId());
        $this->assertEquals(2, $this->fixedSiteIds->getNumProcessedWebsites());
        $this->assertEquals(5, $this->fixedSiteIds->getNextSiteId());
        $this->assertEquals(3, $this->fixedSiteIds->getNumProcessedWebsites());
        $this->assertEquals(9, $this->fixedSiteIds->getNextSiteId());
        $this->assertEquals(4, $this->fixedSiteIds->getNumProcessedWebsites());

        $this->assertNull($this->fixedSiteIds->getNextSiteId());
        $this->assertEquals(4, $this->fixedSiteIds->getNumProcessedWebsites());
    }

}