Skip to content

Commit

Permalink
[Tests] Refactored unit tests to rely on Doctrine QueryBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed Mar 27, 2020
1 parent 2c15b86 commit a385b16
Show file tree
Hide file tree
Showing 7 changed files with 336 additions and 248 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
namespace eZ\Publish\Core\FieldType\Tests\Url\Gateway;

use eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway;
use eZ\Publish\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage;
use eZ\Publish\Core\Persistence\Legacy\Tests\TestCase;

Expand Down Expand Up @@ -180,12 +181,13 @@ public function testUnlinkUrl()
$this->assertEquals($expected, $result);
}

protected function getStorageGateway()
/**
* @throws \Doctrine\DBAL\DBALException
*/
protected function getStorageGateway(): Gateway
{
if (!isset($this->storageGateway)) {
$this->storageGateway = new DoctrineStorage(
$this->getDatabaseHandler()->getConnection()
);
$this->storageGateway = new DoctrineStorage($this->getDatabaseConnection());
}

return $this->storageGateway;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace eZ\Publish\Core\Persistence\Legacy\Tests\Bookmark\Gateway;

use eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway;
use eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\DoctrineDatabase;
use eZ\Publish\Core\Persistence\Legacy\Tests\TestCase;
use eZ\Publish\SPI\Persistence\Bookmark\Bookmark;
Expand Down Expand Up @@ -154,13 +155,11 @@ public function testLocationSwapped()
/**
* Return a ready to test DoctrineStorage gateway.
*
* @return \eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\DoctrineDatabase
* @throws \Doctrine\DBAL\DBALException
*/
protected function getGateway(): DoctrineDatabase
protected function getGateway(): Gateway
{
return new DoctrineDatabase(
$this->getDatabaseHandler()->getConnection()
);
return new DoctrineDatabase($this->getDatabaseConnection());
}

private function loadBookmark(int $id): array
Expand Down
Loading

0 comments on commit a385b16

Please sign in to comment.