Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Doctrine driver to new namespace #342

Merged
merged 1 commit into from
Feb 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/drivers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ And here is the setup of the driver for doctrine dbal:

<?php

use Bernard\Driver\DoctrineDriver;
use Bernard\Driver\Doctrine\Driver;
use Doctrine\DBAL\DriverManager;

$connection = DriverManager::getConnection(array(
Expand All @@ -186,7 +186,7 @@ And here is the setup of the driver for doctrine dbal:
));


$driver = new DoctrineDriver($connection);
$driver = new Driver($connection);

Flatfile
--------
Expand Down
4 changes: 2 additions & 2 deletions example/doctrine.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Bernard\Driver\DoctrineDriver;
use Bernard\Driver\Doctrine\Driver;
use Doctrine\DBAL\DriverManager;

/**
Expand All @@ -16,7 +16,7 @@ function get_driver() {
'driver' => 'pdo_mysql',
));

$doctrineDriver = new DoctrineDriver($connection);
$doctrineDriver = new Driver($connection);

//Don't do this in your application. Use a database set up script instead.
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Bernard\Driver;
namespace Bernard\Driver\Doctrine;

use Doctrine\DBAL\Connection;

Expand All @@ -9,9 +9,9 @@
*
* @package Bernard
*/
class DoctrineDriver implements \Bernard\Driver
final class Driver implements \Bernard\Driver
{
protected $connection;
private $connection;

/**
* {@inheritdoc}
Expand Down Expand Up @@ -154,7 +154,7 @@ public function info()
*
* @return array|null
*/
protected function doPopMessage($queueName)
private function doPopMessage($queueName)
{
$query = 'SELECT id, message FROM bernard_messages
WHERE queue = :queue AND visible = :visible
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php

namespace Bernard\Tests\Driver;
namespace Bernard\Tests\Driver\Doctrine;

use Bernard\Doctrine\MessagesSchema;
use Bernard\Driver\DoctrineDriver;
use Bernard\Driver\Doctrine\Driver;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\Schema;

abstract class AbstractDoctrineDriverTest extends \PHPUnit\Framework\TestCase
abstract class AbstractDriverTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Doctrine\DBAL\Connection
*/
private $connection;

/**
* @var DoctrineDriver
* @var Driver
*/
protected $driver;

Expand All @@ -30,7 +30,7 @@ public function setUp()
}

$this->setUpDatabase();
$this->driver = new DoctrineDriver($this->connection);
$this->driver = new Driver($this->connection);
}

protected function tearDown()
Expand Down Expand Up @@ -171,10 +171,10 @@ protected function setUpDatabase()
/**
* @return \Doctrine\DBAL\Connection
*/
protected abstract function createConnection();
abstract protected function createConnection();

/**
* @return bool
*/
protected abstract function isSupported();
abstract protected function isSupported();
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?php

namespace Bernard\Tests\Driver;

use Bernard\Doctrine\MessagesSchema;
use Bernard\Driver\DoctrineDriver;
namespace Bernard\Tests\Driver\Doctrine;

use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\Schema;

/**
* @group functional
*/
class MySQLDoctrineDriverTest extends AbstractDoctrineDriverTest
class MySQLDriverTest extends AbstractDriverTest
{
protected function isSupported()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?php

namespace Bernard\Tests\Driver;

use Bernard\Doctrine\MessagesSchema;
use Bernard\Driver\DoctrineDriver;
namespace Bernard\Tests\Driver\Doctrine;

use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\Schema;

/**
* @group functional
*/
class PostgreSQLDoctrineDriverTest extends AbstractDoctrineDriverTest
class PostgreSQLDriverTest extends AbstractDriverTest
{
protected function isSupported()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?php

namespace Bernard\Tests\Driver;

use Bernard\Doctrine\MessagesSchema;
use Bernard\Driver\DoctrineDriver;
namespace Bernard\Tests\Driver\Doctrine;

use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\Schema;

/**
* @group functional
*/
class SQLiteDoctrineDriverTest extends AbstractDoctrineDriverTest
class SQLiteDriverTest extends AbstractDriverTest
{
protected function isSupported()
{
Expand Down