-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration for database connection collation
- Loading branch information
Showing
9 changed files
with
179 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
/** | ||
* Matomo - free/libre analytics platform | ||
* | ||
* @link https://matomo.org | ||
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
*/ | ||
|
||
namespace PHPUnit\Integration\Tracker\Db; | ||
|
||
use Piwik\Common; | ||
use Piwik\Config; | ||
use Piwik\Tests\Framework\Fixture; | ||
use Piwik\Tests\Framework\TestCase\IntegrationTestCase; | ||
use Piwik\Tests\Framework\TestCase\SystemTestCase; | ||
use Piwik\Timer; | ||
use Piwik\Tracker; | ||
|
||
/** | ||
* Tracker DB test | ||
* | ||
* @group Core | ||
* @group TrackerDbTest | ||
*/ | ||
class MysqliTest extends IntegrationTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$config = Config::getInstance(); | ||
$config->database['adapter'] = 'MYSQLI'; | ||
} | ||
|
||
public function testConnectionThrowsOnInvalidCharset(): void | ||
{ | ||
self::expectException(Tracker\Db\DbException::class); | ||
self::expectExceptionMessageMatches('/Set Charset failed/'); | ||
|
||
$config = Config::getInstance(); | ||
$config->database['charset'] = 'something really invalid'; | ||
|
||
Tracker\Db::connectPiwikTrackerDb(); | ||
} | ||
|
||
public function testConnectionThrowsOnInvalidConnectionCollation(): void | ||
{ | ||
self::expectException(Tracker\Db\DbException::class); | ||
self::expectExceptionMessageMatches('/Set charset\/connection collation failed/'); | ||
|
||
$config = Config::getInstance(); | ||
$config->database['connection_collation'] = 'something really invalid'; | ||
|
||
Tracker\Db::connectPiwikTrackerDb(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters