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:
authorStefan Giehl <stefan@matomo.org>2020-10-19 22:44:41 +0300
committerGitHub <noreply@github.com>2020-10-19 22:44:41 +0300
commit6029f2c118c6ce3af4ef9b4e35a230b2faed744b (patch)
treed588865e23aee723261e941836f4f5cfede200f8 /tests/PHPUnit/Integration/DbHelperTest.php
parent514a0fc2d492d93303f8b2fd25f3961ef68e18b2 (diff)
Fix check if table exists (#16581)
* Fix check if table exists * add comment to avoid user input * fix query was not working Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>
Diffstat (limited to 'tests/PHPUnit/Integration/DbHelperTest.php')
-rw-r--r--tests/PHPUnit/Integration/DbHelperTest.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/DbHelperTest.php b/tests/PHPUnit/Integration/DbHelperTest.php
index d3ef8941cf..c08553ea87 100644
--- a/tests/PHPUnit/Integration/DbHelperTest.php
+++ b/tests/PHPUnit/Integration/DbHelperTest.php
@@ -8,6 +8,7 @@
namespace Piwik\Tests\Integration;
+use Piwik\Common;
use Piwik\Db;
use Piwik\DbHelper;
use Piwik\Option;
@@ -24,6 +25,13 @@ class DbHelperTest extends IntegrationTestCase
DbHelper::dropDatabase('testdb');
}
+ public function test_tableExists()
+ {
+ $this->assertFalse(DbHelper::tableExists('foobar'));
+ $this->assertTrue(DbHelper::tableExists(Common::prefixTable('user_token_auth')));
+ $this->assertFalse(DbHelper::tableExists(Common::prefixTable('user_t%oke%n_auth')));
+ }
+
public function test_getInstallVersion_isCurrentVersion()
{
$this->assertSame(Version::VERSION, DbHelper::getInstallVersion());