Skip to content

Commit

Permalink
Prefix tables for PDOReader test, otherwise they clash with DbalReader
Browse files Browse the repository at this point in the history
Conflicts:
	tests/Ddeboer/DataImport/Tests/Reader/PdoReaderTest.php
  • Loading branch information
rjmackay committed Jan 20, 2015
1 parent b873a25 commit 694cf21
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/Ddeboer/DataImport/Tests/Reader/PdoReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ public function getConnection()
$connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

// Build schema
$connection->query('CREATE TABLE groups (
$connection->query('CREATE TABLE pdo_group (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(45)
)');

$connection->query('CREATE TABLE user (
$connection->query('CREATE TABLE pdo_user (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username VARCHAR(32),
group_id INTEGER,
FOREIGN KEY(group_id) REFERENCES groups(id)
FOREIGN KEY(group_id) REFERENCES pdo_group(id)
)');
$connection->query('CREATE UNIQUE INDEX user_username ON user(username)');
$connection->query('CREATE UNIQUE INDEX user_username ON pdo_user(username)');

return $connection;
}
Expand All @@ -68,8 +68,8 @@ protected function getReader()
{
$connection = $this->getConnection();

$group_insert = $connection->prepare('INSERT INTO groups (name) VALUES (:name)');
$user_insert = $connection->prepare('INSERT INTO user (username, group_id) VALUES (:username, :group)');
$group_insert = $connection->prepare('INSERT INTO pdo_group (name) VALUES (:name)');
$user_insert = $connection->prepare('INSERT INTO pdo_user (username, group_id) VALUES (:username, :group)');

$counter = 1;
for ($i = 1; $i <= 10; $i++) {
Expand All @@ -86,6 +86,6 @@ protected function getReader()
}
}

return new PdoReader($connection, 'SELECT u.id, u.username, g.name FROM `user` u INNER JOIN groups g ON u.group_id = g.id');
return new PdoReader($connection, 'SELECT u.id, u.username, g.name FROM `pdo_user` u INNER JOIN `pdo_group` g ON u.group_id = g.id');
}
}

0 comments on commit 694cf21

Please sign in to comment.