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
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Integration/Tracker/RequestTest.php15
-rw-r--r--tests/PHPUnit/Integration/Updater/Migration/FactoryTest.php8
-rw-r--r--tests/PHPUnit/System/BackwardsCompatibility1XTest.php11
-rw-r--r--tests/PHPUnit/System/UrlNormalizationTest.php2
-rw-r--r--tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmentedRef__Actions.getPageUrls_day.xml6
-rw-r--r--tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmented__Actions.getPageUrls_day.xml6
-rw-r--r--tests/PHPUnit/System/expected/test_UrlNormalization_urls__Actions.getPageUrls_day.xml6
-rw-r--r--tests/PHPUnit/System/expected/test_Utf8mb4__Live.getLastVisitsDetails_year.xml22
-rw-r--r--tests/PHPUnit/Unit/DataAccess/ArchiveTableCreatorTest.php6
9 files changed, 50 insertions, 32 deletions
diff --git a/tests/PHPUnit/Integration/Tracker/RequestTest.php b/tests/PHPUnit/Integration/Tracker/RequestTest.php
index 33026de7c9..501cd981bb 100644
--- a/tests/PHPUnit/Integration/Tracker/RequestTest.php
+++ b/tests/PHPUnit/Integration/Tracker/RequestTest.php
@@ -9,6 +9,7 @@
namespace Piwik\Tests\Integration\Tracker;
use Matomo\Network\IPUtils;
+use Piwik\Config;
use Piwik\Piwik;
use Piwik\Plugins\CustomVariables\CustomVariables;
use Piwik\Plugins\UsersManager\API;
@@ -447,12 +448,24 @@ class RequestTest extends IntegrationTestCase
* @group invalidChars
* @dataProvider getInvalidCharacterUrls
*/
- public function testInvalidCharacterRemoval($url, $expectedUrl)
+ public function testInvalidCharacterRemovalForUtf8($url, $expectedUrl)
{
+ Config::getInstance()->database['charset'] = 'utf8';
$request = $this->buildRequest(array('url' => $url));
$this->assertEquals($expectedUrl, $request->getParam('url'));
}
+ /**
+ * @group invalidChars
+ * @dataProvider getInvalidCharacterUrls
+ */
+ public function test4ByteCharacterRemainForUtf8mb4($url, $expectedUrl)
+ {
+ Config::getInstance()->database['charset'] = 'utf8mb4';
+ $request = $this->buildRequest(array('url' => $url));
+ $this->assertEquals($url, $request->getParam('url'));
+ }
+
public function getInvalidCharacterUrls()
{
return array(
diff --git a/tests/PHPUnit/Integration/Updater/Migration/FactoryTest.php b/tests/PHPUnit/Integration/Updater/Migration/FactoryTest.php
index cfe1b303ad..ae27537181 100644
--- a/tests/PHPUnit/Integration/Updater/Migration/FactoryTest.php
+++ b/tests/PHPUnit/Integration/Updater/Migration/FactoryTest.php
@@ -12,6 +12,7 @@ use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
use Piwik\Updater\Migration;
use Piwik\Updater\Migration\Db\Factory as DbFactory;
use Piwik\Updater\Migration\Plugin\Factory as PluginFactory;
+use Piwik\Updater\Migration\Config\Factory as ConfigFactory;
/**
* @group Core
@@ -29,7 +30,7 @@ class FactoryTest extends IntegrationTestCase
{
parent::setUp();
- $this->factory = new Migration\Factory(new DbFactory(), new PluginFactory());
+ $this->factory = new Migration\Factory(new DbFactory(), new PluginFactory(), new ConfigFactory());
}
public function test_db_holdsDatabaseFactory()
@@ -42,4 +43,9 @@ class FactoryTest extends IntegrationTestCase
$this->assertTrue($this->factory->plugin instanceof PluginFactory);
}
+ public function test_plugin_holdsConfigFactory()
+ {
+ $this->assertTrue($this->factory->config instanceof ConfigFactory);
+ }
+
}
diff --git a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php
index 30b1489bfb..e2157ac3a9 100644
--- a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php
+++ b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php
@@ -9,6 +9,7 @@ namespace Piwik\Tests\System;
use Piwik\Common;
use Piwik\Db;
+use Piwik\Plugin\Manager;
use Piwik\Plugins\VisitFrequency\API as VisitFrequencyApi;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
use Piwik\Tests\Fixtures\SqlDump;
@@ -24,15 +25,19 @@ class BackwardsCompatibility1XTest extends SystemTestCase
{
const FIXTURE_LOCATION = '/tests/resources/piwik-1.13-dump.sql';
+ /** @var SqlDump $fixture */
public static $fixture = null; // initialized below class
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
- // note: not sure why I have to manually install plugin
- \Piwik\Plugin\Manager::getInstance()->loadPlugin('CustomAlerts')->install();
- \Piwik\Plugin\Manager::getInstance()->loadPlugin('CustomDimensions')->install();
+ $installedPlugins = Manager::getInstance()->getInstalledPluginsName();
+
+ // ensure all plugins are installed correctly (some plugins database tables would be missing otherwise)
+ foreach ($installedPlugins as $installedPlugin) {
+ \Piwik\Plugin\Manager::getInstance()->loadPlugin($installedPlugin)->install();
+ }
$result = Fixture::updateDatabase();
if ($result === false) {
diff --git a/tests/PHPUnit/System/UrlNormalizationTest.php b/tests/PHPUnit/System/UrlNormalizationTest.php
index ca7e60175c..3b1fc15107 100644
--- a/tests/PHPUnit/System/UrlNormalizationTest.php
+++ b/tests/PHPUnit/System/UrlNormalizationTest.php
@@ -110,7 +110,7 @@ class UrlNormalizationTest extends SystemTestCase
array('name' => 'example.org/foo/bar2.html', 'url_prefix' => 3),
array('name' => 'example.org/foo/bar3.html', 'url_prefix' => 1),
array('name' => 'my.url/ꟽ碌㒧䊶亄ﶆⅅขκもኸόσशμεޖृ', 'url_prefix' => 1),
- array('name' => 'make.wordpress.org/?emoji=�l&param=test', 'url_prefix' => 2),
+ array('name' => 'make.wordpress.org/?emoji=😎l&param=test', 'url_prefix' => 2),
array('name' => 'example.org/foo/bar4.html', 'url_prefix' => 2),
);
$this->assertEquals($expected, $urls, "normalization went wrong");
diff --git a/tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmentedRef__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmentedRef__Actions.getPageUrls_day.xml
index 9f90d4f076..b0e0e5763b 100644
--- a/tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmentedRef__Actions.getPageUrls_day.xml
+++ b/tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmentedRef__Actions.getPageUrls_day.xml
@@ -95,7 +95,7 @@
</subtable>
</row>
<row>
- <label>/?emoji=�l&amp;param=test</label>
+ <label>/?emoji=😎l&amp;param=test</label>
<nb_visits>1</nb_visits>
<nb_uniq_visitors>1</nb_uniq_visitors>
<nb_hits>1</nb_hits>
@@ -109,8 +109,8 @@
<avg_time_on_page>0</avg_time_on_page>
<bounce_rate>0%</bounce_rate>
<exit_rate>0%</exit_rate>
- <url>https://make.wordpress.org/?emoji=�l&amp;param=test</url>
- <segment>pageUrl==https%253A%252F%252Fmake.wordpress.org%252F%253Femoji%253D%25EF%25BF%25BDl%2526param%253Dtest</segment>
+ <url>https://make.wordpress.org/?emoji=😎l&amp;param=test</url>
+ <segment>pageUrl==https%253A%252F%252Fmake.wordpress.org%252F%253Femoji%253D%25F0%259F%2598%258El%2526param%253Dtest</segment>
</row>
<row>
<label>/ꟽ碌㒧䊶亄ﶆⅅขκもኸόσशμεޖृ</label>
diff --git a/tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmented__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmented__Actions.getPageUrls_day.xml
index 9f90d4f076..b0e0e5763b 100644
--- a/tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmented__Actions.getPageUrls_day.xml
+++ b/tests/PHPUnit/System/expected/test_UrlNormalization_pagesSegmented__Actions.getPageUrls_day.xml
@@ -95,7 +95,7 @@
</subtable>
</row>
<row>
- <label>/?emoji=�l&amp;param=test</label>
+ <label>/?emoji=😎l&amp;param=test</label>
<nb_visits>1</nb_visits>
<nb_uniq_visitors>1</nb_uniq_visitors>
<nb_hits>1</nb_hits>
@@ -109,8 +109,8 @@
<avg_time_on_page>0</avg_time_on_page>
<bounce_rate>0%</bounce_rate>
<exit_rate>0%</exit_rate>
- <url>https://make.wordpress.org/?emoji=�l&amp;param=test</url>
- <segment>pageUrl==https%253A%252F%252Fmake.wordpress.org%252F%253Femoji%253D%25EF%25BF%25BDl%2526param%253Dtest</segment>
+ <url>https://make.wordpress.org/?emoji=😎l&amp;param=test</url>
+ <segment>pageUrl==https%253A%252F%252Fmake.wordpress.org%252F%253Femoji%253D%25F0%259F%2598%258El%2526param%253Dtest</segment>
</row>
<row>
<label>/ꟽ碌㒧䊶亄ﶆⅅขκもኸόσशμεޖृ</label>
diff --git a/tests/PHPUnit/System/expected/test_UrlNormalization_urls__Actions.getPageUrls_day.xml b/tests/PHPUnit/System/expected/test_UrlNormalization_urls__Actions.getPageUrls_day.xml
index 9f90d4f076..b0e0e5763b 100644
--- a/tests/PHPUnit/System/expected/test_UrlNormalization_urls__Actions.getPageUrls_day.xml
+++ b/tests/PHPUnit/System/expected/test_UrlNormalization_urls__Actions.getPageUrls_day.xml
@@ -95,7 +95,7 @@
</subtable>
</row>
<row>
- <label>/?emoji=�l&amp;param=test</label>
+ <label>/?emoji=😎l&amp;param=test</label>
<nb_visits>1</nb_visits>
<nb_uniq_visitors>1</nb_uniq_visitors>
<nb_hits>1</nb_hits>
@@ -109,8 +109,8 @@
<avg_time_on_page>0</avg_time_on_page>
<bounce_rate>0%</bounce_rate>
<exit_rate>0%</exit_rate>
- <url>https://make.wordpress.org/?emoji=�l&amp;param=test</url>
- <segment>pageUrl==https%253A%252F%252Fmake.wordpress.org%252F%253Femoji%253D%25EF%25BF%25BDl%2526param%253Dtest</segment>
+ <url>https://make.wordpress.org/?emoji=😎l&amp;param=test</url>
+ <segment>pageUrl==https%253A%252F%252Fmake.wordpress.org%252F%253Femoji%253D%25F0%259F%2598%258El%2526param%253Dtest</segment>
</row>
<row>
<label>/ꟽ碌㒧䊶亄ﶆⅅขκもኸόσशμεޖृ</label>
diff --git a/tests/PHPUnit/System/expected/test_Utf8mb4__Live.getLastVisitsDetails_year.xml b/tests/PHPUnit/System/expected/test_Utf8mb4__Live.getLastVisitsDetails_year.xml
index 3aa91520d2..c282465a49 100644
--- a/tests/PHPUnit/System/expected/test_Utf8mb4__Live.getLastVisitsDetails_year.xml
+++ b/tests/PHPUnit/System/expected/test_Utf8mb4__Live.getLastVisitsDetails_year.xml
@@ -15,34 +15,34 @@
<itemDetails>
<row>
- <itemSKU>sku �</itemSKU>
- <itemName>name �</itemName>
- <itemCategory>category �</itemCategory>
+ <itemSKU>sku 🛸</itemSKU>
+ <itemName>name 🛩</itemName>
+ <itemCategory>category 🛤</itemCategory>
<price>95</price>
<quantity>1</quantity>
<categories>
- <row>category �</row>
+ <row>category 🛤</row>
</categories>
</row>
</itemDetails>
<icon>plugins/Morpheus/images/ecommerceAbandonedCart.png</icon>
<iconSVG>plugins/Morpheus/images/ecommerceAbandonedCart.svg</iconSVG>
<title>Abandoned Cart</title>
- <subtitle>$100 revenue - 1 items: name �)</subtitle>
+ <subtitle>$100 revenue - 1 items: name 🛩)</subtitle>
</row>
<row>
<type>action</type>
- <url>http://example.org/foo/�.html</url>
- <pageTitle>incredible �</pageTitle>
+ <url>http://example.org/foo/🙙.html</url>
+ <pageTitle>incredible 🚜</pageTitle>
<pageIdAction>2</pageIdAction>
<pageId>1</pageId>
<bandwidth />
<pageviewPosition>1</pageviewPosition>
- <title>incredible �</title>
- <subtitle>http://example.org/foo/�.html</subtitle>
+ <title>incredible 🚜</title>
+ <subtitle>http://example.org/foo/🙙.html</subtitle>
<icon />
<iconSVG>plugins/Morpheus/images/action.svg</iconSVG>
@@ -81,9 +81,9 @@
<referrerType>search</referrerType>
<referrerTypeName>Search Engines</referrerTypeName>
<referrerName>Google</referrerName>
- <referrerKeyword>�</referrerKeyword>
+ <referrerKeyword>😡</referrerKeyword>
<referrerKeywordPosition />
- <referrerUrl>http://www.google.com/search?q=�</referrerUrl>
+ <referrerUrl>http://www.google.com/search?q=😡</referrerUrl>
<referrerSearchEngineUrl>http://google.com</referrerSearchEngineUrl>
<referrerSearchEngineIcon>plugins/Morpheus/icons/dist/searchEngines/google.com.png</referrerSearchEngineIcon>
<referrerSocialNetworkUrl />
diff --git a/tests/PHPUnit/Unit/DataAccess/ArchiveTableCreatorTest.php b/tests/PHPUnit/Unit/DataAccess/ArchiveTableCreatorTest.php
index 565045a915..6743b167f9 100644
--- a/tests/PHPUnit/Unit/DataAccess/ArchiveTableCreatorTest.php
+++ b/tests/PHPUnit/Unit/DataAccess/ArchiveTableCreatorTest.php
@@ -24,12 +24,9 @@ class ArchiveTableCreatorTest extends \PHPUnit\Framework\TestCase
$this->tables = array(
'archive_numeric_2015_02',
'archive_blob_2015_05',
- 'garbage',
'archive_numeric_2014_03',
'archive_blob_2015_01',
'archive_blob_2015_02',
- 'aslkdfjsd',
- 'prefixed_archive_numeric_2012_01',
);
}
@@ -69,7 +66,6 @@ class ArchiveTableCreatorTest extends \PHPUnit\Framework\TestCase
array(
'archive_numeric_2015_02',
'archive_numeric_2014_03',
- 'prefixed_archive_numeric_2012_01',
),
),
@@ -86,7 +82,6 @@ class ArchiveTableCreatorTest extends \PHPUnit\Framework\TestCase
'archive_numeric_2014_03',
'archive_blob_2015_01',
'archive_blob_2015_02',
- 'prefixed_archive_numeric_2012_01',
),
),
@@ -98,7 +93,6 @@ class ArchiveTableCreatorTest extends \PHPUnit\Framework\TestCase
'archive_numeric_2014_03',
'archive_blob_2015_01',
'archive_blob_2015_02',
- 'prefixed_archive_numeric_2012_01',
),
),
);