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

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2017-06-29 18:12:45 +0300
committerStefan Giehl <stefan@piwik.org>2017-06-29 18:12:45 +0300
commit1bad9317e6eef0d4a26dedcb65dd9f538d6cc633 (patch)
tree7186662be774530b294c7f9b2c462bdf337c82c4 /tests/PHPUnit
parentb3395668ad0fbe4f454d50a98a00b778de59dcc4 (diff)
More generic raw log access (#11775)
Diffstat (limited to 'tests/PHPUnit')
-rw-r--r--tests/PHPUnit/System/RawLogDaoTest.php62
1 files changed, 60 insertions, 2 deletions
diff --git a/tests/PHPUnit/System/RawLogDaoTest.php b/tests/PHPUnit/System/RawLogDaoTest.php
index e0210467e2..7046c53a34 100644
--- a/tests/PHPUnit/System/RawLogDaoTest.php
+++ b/tests/PHPUnit/System/RawLogDaoTest.php
@@ -12,6 +12,24 @@ use Piwik\DataAccess\RawLogDao;
use Piwik\Tests\Framework\Fixture;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
+class CustomRawLogDao extends RawLogDao {
+
+ public function getTableIdColumns()
+ {
+ return parent::getTableIdColumns();
+ }
+
+ public function getIdFieldForLogTable($logTable)
+ {
+ return parent::getIdFieldForLogTable($logTable);
+ }
+
+ public function getMaxIdsInLogTables()
+ {
+ return parent::getMaxIdsInLogTables();
+ }
+}
+
/**
* @group Core
* @group RawLogDao
@@ -20,7 +38,7 @@ use Piwik\Tests\Framework\TestCase\SystemTestCase;
class RawLogDaoTest extends SystemTestCase
{
/**
- * @var RawLogDao
+ * @var CustomRawLogDao
*/
private $dao;
@@ -34,7 +52,7 @@ class RawLogDaoTest extends SystemTestCase
Fixture::createWebsite('2010-00-00 00:00:00');
}
- $this->dao = new RawLogDao();
+ $this->dao = new CustomRawLogDao();
}
/**
@@ -48,6 +66,46 @@ class RawLogDaoTest extends SystemTestCase
$this->assertSame($expectedHasVisits, $hasVisits);
}
+ public function test_getIdColumns()
+ {
+ $expected = array(
+ 'log_action' => 'idaction',
+ 'log_conversion_item' => 'idvisit',
+ 'log_conversion' => 'idvisit',
+ 'log_link_visit_action' => 'idlink_va',
+ 'log_visit' => 'idvisit',
+ );
+ $this->assertSame($expected, $this->dao->getTableIdColumns());
+ }
+
+ public function test_getIdFieldForLogTable()
+ {
+ $this->assertSame('idaction', $this->dao->getIdFieldForLogTable('log_action'));
+ $this->assertSame('idlink_va', $this->dao->getIdFieldForLogTable('log_link_visit_action'));
+ $this->assertSame('idvisit', $this->dao->getIdFieldForLogTable('log_visit'));
+ }
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage Unknown log table 'log_foobarbaz'
+ */
+ public function test_getIdFieldForLogTable_whenUnknownTable()
+ {
+ $this->dao->getIdFieldForLogTable('log_foobarbaz');
+ }
+
+ public function test_getMaxIdsInLogTables()
+ {
+ $expected = array(
+ 'log_action' => '2',
+ 'log_conversion_item' => null,
+ 'log_conversion' => null,
+ 'log_link_visit_action' => '11',
+ 'log_visit' => '1',
+ );
+ $this->assertSame($expected, $this->dao->getMaxIdsInLogTables());
+ }
+
public function getVisitsInTimeFrameData()
{
return array(