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>2018-11-29 10:22:15 +0300
committerGitHub <noreply@github.com>2018-11-29 10:22:15 +0300
commit73010596f01b9660899267305fe0cf5064428753 (patch)
tree367851f6c476d10f51c0a2a8756f02d260583d83 /tests/PHPUnit/Integration/DbHelperTest.php
parent970883b106229f11a071c5470538bfb29dc83871 (diff)
Make matomo.js and matomo.php the default Tracking API endpoints used (#13596)
* Make matomo.js and matomo.php the default Tracking API endpoints used * few fixes * fix few tests * update matomo php tracker in composer * make sure to record install version * do not overwrite ever install version * trying to fix test * more tweaks and fix tests * prefer matomo endpoint in the ui, fix some tests * file was still needed * apply review feedback * fix ui tests
Diffstat (limited to 'tests/PHPUnit/Integration/DbHelperTest.php')
-rw-r--r--tests/PHPUnit/Integration/DbHelperTest.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/DbHelperTest.php b/tests/PHPUnit/Integration/DbHelperTest.php
index f8268f451c..5b88015eab 100644
--- a/tests/PHPUnit/Integration/DbHelperTest.php
+++ b/tests/PHPUnit/Integration/DbHelperTest.php
@@ -10,7 +10,9 @@ namespace Piwik\Tests\Integration;
use Piwik\Db;
use Piwik\DbHelper;
+use Piwik\Option;
use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
+use Piwik\Version;
class DbHelperTest extends IntegrationTestCase
{
@@ -22,6 +24,52 @@ class DbHelperTest extends IntegrationTestCase
DbHelper::dropDatabase('testdb');
}
+ public function test_getInstallVersion_isCurrentVersion()
+ {
+ $this->assertSame(Version::VERSION, DbHelper::getInstallVersion());
+ }
+
+ public function test_recordInstallVersion_setsCurrentVersion()
+ {
+ Option::delete(Db\Schema\Mysql::OPTION_NAME_MATOMO_INSTALL_VERSION);
+ $this->assertNull(DbHelper::getInstallVersion());
+
+ DbHelper::recordInstallVersion();
+ $this->assertSame(Version::VERSION, DbHelper::getInstallVersion());
+ }
+
+ public function test_recordInstallVersion_doesNotOverwritePreviouslySetVersion()
+ {
+ $this->setInstallVersion('2.1.0');
+ DbHelper::recordInstallVersion();
+ DbHelper::recordInstallVersion();
+ DbHelper::recordInstallVersion();
+ $this->assertSame('2.1.0', DbHelper::getInstallVersion());
+ }
+
+ public function test_wasMatomoInstalledBeforeVersion_sameVersion()
+ {
+ $this->setInstallVersion('2.1.0');
+ $this->assertFalse(DbHelper::wasMatomoInstalledBeforeVersion('2.1.0'));
+ }
+
+ public function test_wasMatomoInstalledBeforeVersion_whenUsedNewerVersion()
+ {
+ $this->setInstallVersion('2.1.0');
+ $this->assertFalse(DbHelper::wasMatomoInstalledBeforeVersion('2.0.0'));
+ }
+
+ public function test_wasMatomoInstalledBeforeVersion_whenWasInstalledBeforeThatVersion()
+ {
+ $this->setInstallVersion('2.1.0');
+ $this->assertTrue(DbHelper::wasMatomoInstalledBeforeVersion('2.2.0'));
+ }
+
+ private function setInstallVersion($version)
+ {
+ Option::set(Db\Schema\Mysql::OPTION_NAME_MATOMO_INSTALL_VERSION, $version);
+ }
+
public function test_createDatabase_escapesInputProperly()
{
$dbName = 'newdb`; create database anotherdb;`';