Skip to content

Commit

Permalink
Change phpunit constant nnames to include mysql. Added constants for …
Browse files Browse the repository at this point in the history
…mongo
  • Loading branch information
kbrabrand committed May 16, 2015
1 parent cecd520 commit ee40ae7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
22 changes: 15 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,25 @@

<php>
<!-- DAO integration tests -->
<const name="DAO_DB_HOST" value="" />
<const name="DAO_DB_PORT" value="" />
<const name="DAO_DB_NAME" value="" />
<const name="DAO_MYSQL_HOST" value="" />
<const name="DAO_MYSQL_PORT" value="" />
<const name="DAO_MYSQL_NAME" value="" />

<const name="DAO_MONGO_HOST" value="" />
<const name="DAO_MONGO_PORT" value="" />
<const name="DAO_MONGO_NAME" value="" />

<!-- NOTE: The RW user needs CREATE TABLE and DROP TABLE access -->
<const name="DAO_DB_RW_USER" value="" />
<const name="DAO_DB_RW_PASS" value="" />
<const name="DAO_MYSQL_RW_USER" value="" />
<const name="DAO_MYSQL_RW_PASS" value="" />
<const name="DAO_MONGO_RW_USER" value="" />
<const name="DAO_MONGO_RW_PASS" value="" />

<!-- NOTE: The RO user needs read access to the 'daoTest' table -->
<const name="DAO_DB_RO_USER" value="" />
<const name="DAO_DB_RO_PASS" value="" />
<const name="DAO_MYSQL_RO_USER" value="" />
<const name="DAO_MYSQL_RO_PASS" value="" />
<const name="DAO_MONGO_RO_USER" value="" />
<const name="DAO_MONGO_RO_PASS" value="" />

<const name="DAO_ELASTIC_SEARCH_HOST" value="localhost" />
<const name="DAO_ELASTIC_SEARCH_PORT" value="9200" />
Expand Down
26 changes: 13 additions & 13 deletions tests/DaoIntegrationTest/Models/Dao/MySQLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ public function setUp()
}

$constants = [
'DAO_DB_HOST',
'DAO_DB_PORT',
'DAO_DB_NAME',
'DAO_MYSQL_HOST',
'DAO_MYSQL_PORT',
'DAO_MYSQL_NAME',

'DAO_DB_RO_USER',
'DAO_DB_RO_PASS',
'DAO_MYSQL_RO_USER',
'DAO_MYSQL_RO_PASS',

'DAO_DB_RW_USER',
'DAO_DB_RW_PASS',
'DAO_MYSQL_RW_USER',
'DAO_MYSQL_RW_PASS',

'DAO_ELASTIC_SEARCH_HOST',
'DAO_ELASTIC_SEARCH_PORT',
Expand All @@ -91,14 +91,14 @@ public function setUp()

$roDb = new PDO(
$this->getDsn(),
DAO_DB_RO_USER,
DAO_DB_RO_PASS
DAO_MYSQL_RO_USER,
DAO_MYSQL_RO_PASS
);

$rwDb = new PDO(
$this->getDsn(),
DAO_DB_RW_USER,
DAO_DB_RW_PASS
DAO_MYSQL_RW_USER,
DAO_MYSQL_RW_PASS
);

$memcached = new Memcached();
Expand Down Expand Up @@ -339,8 +339,8 @@ private function getElasticIndex()

private function getDsn()
{
$dsn = 'mysql:host=' . DAO_DB_HOST . ';port=' . DAO_DB_PORT;
$dsn .= ';dbname=' . DAO_DB_NAME . ';';
$dsn = 'mysql:host=' . DAO_MYSQL_HOST . ';port=' . DAO_MYSQL_PORT;
$dsn .= ';dbname=' . DAO_MYSQL_NAME . ';';

return $dsn;
}
Expand Down

0 comments on commit ee40ae7

Please sign in to comment.