blob: 1ec10bdebfeeb6792a2cf21d90fb32c044bd83c2 (
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
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Tests\Integration\DataAccess;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
use Piwik\DataAccess\Model;
/**
* @group Core
* @group DataAccess
*/
class ModelTest extends IntegrationTestCase
{
/**
* @var Model
*/
private $model;
private $tableName = 'archive_numeric_test';
public function setUp()
{
parent::setUp();
$this->model = new Model();
$this->model->createArchiveTable($this->tableName, 'archive_numeric');
}
public function test_insertNewArchiveId()
{
$this->assertAllocatedArchiveId(1);
$this->assertAllocatedArchiveId(2);
$this->assertAllocatedArchiveId(3);
$this->assertAllocatedArchiveId(4);
$this->assertAllocatedArchiveId(5);
$this->assertAllocatedArchiveId(6);
}
private function assertAllocatedArchiveId($expectedId)
{
$id = $this->model->allocateNewArchiveId($this->tableName);
$this->assertEquals($expectedId, $id);
}
}
|