Skip to content

Commit

Permalink
Remove deprecated code for doctrine < 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu authored and OskarStark committed Dec 9, 2019
1 parent 5ab03f8 commit 74feb9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
15 changes: 3 additions & 12 deletions tests/Datagrid/OrderByToSelectWalkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ public function testOrderByCompositeId(): void
$query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, [OrderByToSelectWalker::class]);

$this->assertSame(
// NEXT_MAJOR: Remove this check when dropping support for doctrine/orm < 2.5
version_compare(Version::VERSION, '2.5') < 0
? 'SELECT DISTINCT s0_.store_id AS sclr0, s0_.product_id AS sclr1, s0_.name AS name2 FROM StoreProduct s0_ ORDER BY s0_.name ASC, s0_.product_id DESC'
: 'SELECT DISTINCT s0_.store_id AS sclr_0, s0_.product_id AS sclr_1, s0_.name AS name_2 FROM StoreProduct s0_ ORDER BY s0_.name ASC, s0_.product_id DESC',
'SELECT DISTINCT s0_.store_id AS sclr_0, s0_.product_id AS sclr_1, s0_.name AS name_2 FROM StoreProduct s0_ ORDER BY s0_.name ASC, s0_.product_id DESC',
$query->getSQL()
);
}
Expand All @@ -76,10 +73,7 @@ public function testOrderByCompositeIdWholeObject(): void
$query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, [OrderByToSelectWalker::class]);

$this->assertSame(
// NEXT_MAJOR: Remove this check when dropping support for doctrine/orm < 2.5
version_compare(Version::VERSION, '2.5') < 0
? 'SELECT DISTINCT s0_.name AS name0, s0_.store_id AS store_id1, s0_.product_id AS product_id2 FROM StoreProduct s0_ ORDER BY s0_.name ASC, s0_.product_id DESC'
: 'SELECT DISTINCT s0_.name AS name_0, s0_.store_id AS store_id_1, s0_.product_id AS product_id_2 FROM StoreProduct s0_ ORDER BY s0_.name ASC, s0_.product_id DESC',
'SELECT DISTINCT s0_.name AS name_0, s0_.store_id AS store_id_1, s0_.product_id AS product_id_2 FROM StoreProduct s0_ ORDER BY s0_.name ASC, s0_.product_id DESC',
$query->getSQL()
);
}
Expand All @@ -96,10 +90,7 @@ public function testOrderByAssociation(): void
$query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, [OrderByToSelectWalker::class]);

$this->assertSame(
// NEXT_MAJOR: Remove this check when dropping support for doctrine/orm < 2.5
version_compare(Version::VERSION, '2.5') < 0
? 'SELECT DISTINCT m0_.id AS id0, m0_.tree_root AS sclr1, m0_.lft AS lft2 FROM Menu m0_ ORDER BY m0_.tree_root ASC, m0_.lft ASC'
: 'SELECT DISTINCT m0_.id AS id_0, m0_.tree_root AS sclr_1, m0_.lft AS lft_2 FROM Menu m0_ ORDER BY m0_.tree_root ASC, m0_.lft ASC',
'SELECT DISTINCT m0_.id AS id_0, m0_.tree_root AS sclr_1, m0_.lft AS lft_2 FROM Menu m0_ ORDER BY m0_.tree_root ASC, m0_.lft ASC',
$query->getSQL()
);
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Datagrid/ProxyQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataFactory;
Expand Down Expand Up @@ -115,11 +116,10 @@ public function testGetFixedQueryBuilder($class, $alias, $id, $expectedId, $valu
->method('getConnection')
->willReturn($conn);

// NEXT MAJOR: Replace this when dropping PHP < 5.6
// $q = $this->createMock('PDOStatement');
$q = $this->getMockBuilder('stdClass')
->setMethods(['execute', 'setHint'])
->getMock();
$q = $this->getMockBuilder(AbstractQuery::class)
->disableOriginalConstructor()
->setMethods(['setHint', 'execute'])
->getMockForAbstractClass();
$q->expects($this->once())
->method('setHint')
->willReturn($q);
Expand Down
6 changes: 0 additions & 6 deletions tests/Model/ModelManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,6 @@ public function testLock($isVersioned, $expectsException): void

public function testGetParentMetadataForProperty(): void
{
if (version_compare(Version::VERSION, '2.5') < 0) {
$this->markTestSkipped('Test for embeddables needs to run on Doctrine >= 2.5');

return;
}

$containerEntityClass = ContainerEntity::class;
$associatedEntityClass = AssociatedEntity::class;
$embeddedEntityClass = EmbeddedEntity::class;
Expand Down

0 comments on commit 74feb9b

Please sign in to comment.