Skip to content

Commit 249eab8

Browse files
authored
Remove obsolete version checks (#432)
1 parent c15bd5e commit 249eab8

File tree

2 files changed

+8
-38
lines changed

2 files changed

+8
-38
lines changed

tests/Query/Mysql/DateTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace DoctrineExtensions\Tests\Query\Mysql;
44

5-
use Doctrine\ORM\Version;
65
use DoctrineExtensions\Tests\Query\MysqlTestCase;
76

87
use function date;
@@ -27,10 +26,6 @@ public function testDateAdd(): void
2726

2827
public function testDateAddWithColumnAlias(): void
2928
{
30-
if (Version::VERSION < 2.2) {
31-
$this->markTestSkipped('Alias is not supported in Doctrine 2.1 and lower');
32-
}
33-
3429
$dql = "SELECT p.created as alternative FROM DoctrineExtensions\Tests\Entities\Date p HAVING DATEADD(alternative, 4, 'MONTH') < 7";
3530
$sql = 'SELECT d0_.created AS created_0 FROM Date d0_ HAVING DATE_ADD(created_0, INTERVAL 4 MONTH) < 7';
3631

@@ -71,10 +66,6 @@ public function testFromUnixtime(): void
7166

7267
public function testPeriodDiff(): void
7368
{
74-
if (Version::VERSION < 2.3) {
75-
$this->markTestSkipped('Doctrine 2.2 moans about something or other');
76-
}
77-
7869
$dql = "SELECT PERIOD_DIFF(date_format(p.created, '%Y%m'), date_format(p.created, '%Y%m')) FROM DoctrineExtensions\Tests\Entities\Date p";
7970
$sql = "SELECT PERIOD_DIFF(DATE_FORMAT(d0_.created, '%Y%m'), DATE_FORMAT(d0_.created, '%Y%m')) AS sclr_0 FROM Date d0_";
8071

tests/Query/Mysql/TrigTest.php

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace DoctrineExtensions\Tests\Query\Mysql;
44

55
use Doctrine\ORM\Query;
6-
use Doctrine\ORM\Version;
76
use DoctrineExtensions\Tests\Query\MysqlTestCase;
87

98
use function deg2rad;
@@ -42,13 +41,8 @@ public function testSin(): void
4241
$sql = 'SELECT SIN(RADIANS(b0_.latitude) * RADIANS(b0_.longitude)) AS sclr_0 FROM BlogPost b0_';
4342
$this->assertEquals($sql, $q->getSql());
4443

45-
if (Version::compare('2.4.0') <= 0) {
46-
$dql = 'SELECT p FROM ' . $this->entity . ' p WHERE p.longitude = SIN(RADIANS(p.latitude)) * RADIANS(p.longitude)';
47-
} else {
48-
$dql = 'SELECT p FROM ' . $this->entity . ' p WHERE p.longitude = (SIN(RADIANS(p.latitude)) * RADIANS(p.longitude))';
49-
}
50-
51-
$q = $this->entityManager->createQuery($dql);
44+
$dql = 'SELECT p FROM ' . $this->entity . ' p WHERE p.longitude = SIN(RADIANS(p.latitude)) * RADIANS(p.longitude)';
45+
$q = $this->entityManager->createQuery($dql);
5246

5347
$sql = 'SELECT b0_.id AS id_0, b0_.created AS created_1, b0_.longitude AS longitude_2, b0_.latitude AS latitude_3 FROM BlogPost b0_ WHERE b0_.longitude = SIN(RADIANS(b0_.latitude)) * RADIANS(b0_.longitude)';
5448
$this->assertEquals($sql, $q->getSql());
@@ -59,13 +53,8 @@ public function testSin(): void
5953
$sql = 'SELECT b0_.id AS id_0, b0_.created AS created_1, b0_.longitude AS longitude_2, b0_.latitude AS latitude_3 FROM BlogPost b0_ WHERE SIN(RADIANS(b0_.latitude)) * SIN(RADIANS(b0_.longitude)) = 1';
6054
$this->assertEquals($sql, $q->getSql());
6155

62-
if (Version::compare('2.4.0') <= 0) {
63-
$dql = 'SELECT SIN(RADIANS(p.latitude)) * SIN(RADIANS(p.longitude)) FROM ' . $this->entity . ' p ';
64-
} else {
65-
$dql = 'SELECT (SIN(RADIANS(p.latitude)) * SIN(RADIANS(p.longitude))) FROM ' . $this->entity . ' p ';
66-
}
67-
68-
$q = $this->entityManager->createQuery($dql);
56+
$dql = 'SELECT SIN(RADIANS(p.latitude)) * SIN(RADIANS(p.longitude)) FROM ' . $this->entity . ' p ';
57+
$q = $this->entityManager->createQuery($dql);
6958

7059
$sql = 'SELECT SIN(RADIANS(b0_.latitude)) * SIN(RADIANS(b0_.longitude)) AS sclr_0 FROM BlogPost b0_';
7160
$this->assertEquals($sql, $q->getSql());
@@ -82,13 +71,8 @@ public function testAcos(): void
8271
$this->assertFirstQuery('ACOS');
8372
$this->assertSecondQuery('ACOS');
8473

85-
if (Version::compare('2.4.0') <= 0) {
86-
$dql = 'SELECT ACOS(SIN(RADIANS(p.latitude)) + SIN(RADIANS(p.longitude))) * 1 FROM ' . $this->entity . ' p';
87-
} else {
88-
$dql = 'SELECT (ACOS(SIN(RADIANS(p.latitude)) + SIN(RADIANS(p.longitude))) * 1) FROM ' . $this->entity . ' p';
89-
}
90-
91-
$q = $this->entityManager->createQuery($dql);
74+
$dql = 'SELECT ACOS(SIN(RADIANS(p.latitude)) + SIN(RADIANS(p.longitude))) * 1 FROM ' . $this->entity . ' p';
75+
$q = $this->entityManager->createQuery($dql);
9276

9377
$sql = 'SELECT ACOS(SIN(RADIANS(b0_.latitude)) + SIN(RADIANS(b0_.longitude))) * 1 AS sclr_0 FROM BlogPost b0_';
9478
$this->assertEquals($sql, $q->getSql());
@@ -158,13 +142,8 @@ public function testCosineLaw(): void
158142
. '* COS(RADIANS(p.longitude) - ' . deg2rad($lng) . ')'
159143
. ') * ' . $radiusOfEarth;
160144

161-
if (Version::compare('2.4.0') <= 0) {
162-
$dql = 'SELECT ' . $cosineLaw . ' FROM ' . $this->entity . ' p';
163-
} else {
164-
$dql = 'SELECT (' . $cosineLaw . ') FROM ' . $this->entity . ' p';
165-
}
166-
167-
$q = $this->entityManager->createQuery($dql);
145+
$dql = 'SELECT ' . $cosineLaw . ' FROM ' . $this->entity . ' p';
146+
$q = $this->entityManager->createQuery($dql);
168147

169148
$sql = 'SELECT ACOS(SIN(0) * SIN(RADIANS(b0_.latitude)) + COS(0) * COS(RADIANS(b0_.latitude)) * COS(RADIANS(b0_.longitude) - 0)) * 6371 AS sclr_0 FROM BlogPost b0_';
170149
$this->assertEquals($sql, $q->getSql());

0 commit comments

Comments
 (0)