From 78dd8a7a2e86e197168763c24177c4710d7f212f Mon Sep 17 00:00:00 2001 From: Thomas Steur <thomas.steur@googlemail.com> Date: Thu, 16 Oct 2014 03:38:06 +0200 Subject: [PATCH] refs #6417 added a simple test for creating archiveid --- .../Integration/DataAccess/ModelTest.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/PHPUnit/Integration/DataAccess/ModelTest.php diff --git a/tests/PHPUnit/Integration/DataAccess/ModelTest.php b/tests/PHPUnit/Integration/DataAccess/ModelTest.php new file mode 100644 index 0000000000..62ccaeaade --- /dev/null +++ b/tests/PHPUnit/Integration/DataAccess/ModelTest.php @@ -0,0 +1,49 @@ +<?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\Tests\Framework\TestCase\IntegrationTestCase; +use Piwik\DataAccess\Model; + +/** + * @group Core + * @group DataAccess + */ +class Core_DataAccess_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->assertCreatedArchiveId(1); + $this->assertCreatedArchiveId(2); + $this->assertCreatedArchiveId(3); + $this->assertCreatedArchiveId(4); + $this->assertCreatedArchiveId(5, 2); + $this->assertCreatedArchiveId(6, 2); + } + + private function assertCreatedArchiveId($expectedId, $siteId = 1) + { + $id = $this->model->insertNewArchiveId($this->tableName, $siteId, '2014-01-01 00:01:02'); + + $this->assertEquals($expectedId, $id); + } + +} \ No newline at end of file -- GitLab