Add test database credentials to phpunit config to allow local overriding.

parent 98f13b08
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.6/phpunit.xsd"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
bootstrap="./tests/Bootstrap.php"
backupGlobals="false"
backupStaticAttributes="false"
......@@ -23,6 +23,10 @@
<php>
<ini name="error_reporting" value="-1" />
<const name="PHPUNIT_TESTSUITE" value="true"/>
<const name="PHPUNIT_DB_HOST" value="127.0.0.1"/>
<const name="PHPUNIT_DB_NAME" value="telegrambot"/>
<const name="PHPUNIT_DB_USER" value="root"/>
<const name="PHPUNIT_DB_PASS" value=""/>
</php>
<testsuites>
<testsuite name="Package Test Suite">
......
......@@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS `chat` (
KEY `old_id` (`old_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
CREATE TABLE IF NOT EXISTS `user_chat` (
CREATE TABLE IF NOT EXISTS `user_chat` (
`user_id` bigint COMMENT 'Unique user identifier',
`chat_id` bigint COMMENT 'Unique user or chat identifier',
......
......@@ -34,14 +34,14 @@ class ConversationTest extends TestCase
protected function setUp()
{
$credentials = [
'host' => '127.0.0.1',
'user' => 'root',
'password' => '',
'database' => 'telegrambot',
'host' => PHPUNIT_DB_HOST,
'database' => PHPUNIT_DB_NAME,
'user' => PHPUNIT_DB_USER,
'password' => PHPUNIT_DB_PASS,
];
$this->telegram = new Telegram('testapikey', 'testbotname');
$this->telegram->enableMySQL($credentials);
$this->telegram->enableMySql($credentials);
//Make sure we start with an empty DB for each test.
TestHelpers::emptyDB($credentials);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment