44
55namespace Doctrine \Tests \ORM \Functional ;
66
7+ use Doctrine \DBAL \Platforms \PostgreSQLPlatform ;
78use Doctrine \Tests \Models \Company \CompanyEmployee ;
89use Doctrine \Tests \OrmFunctionalTestCase ;
9-
1010use function count ;
1111
1212/**
@@ -25,11 +25,21 @@ protected function setUp(): void
2525 $ this ->generateFixture ();
2626 }
2727
28+ private function skipIfPostgres (string $ test ): void
29+ {
30+ $ platform = $ this ->_em ->getConnection ()->getDatabasePlatform ();
31+ if ($ platform instanceof PostgreSQLPlatform) {
32+ self ::markTestSkipped (
33+ 'The ' . $ test . ' test does not work on postgresql (see https://github.com/doctrine/orm/pull/8012). '
34+ );
35+ }
36+ }
37+
2838 public function testOrderWithArithmeticExpressionWithSingleValuedPathExpression (): void
2939 {
3040 $ dql = 'SELECT p ' .
31- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
32- 'ORDER BY p.id + p.id ASC ' ;
41+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
42+ 'ORDER BY p.id + p.id ASC ' ;
3343
3444 /** @var CompanyEmployee[] $result */
3545 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -42,8 +52,8 @@ public function testOrderWithArithmeticExpressionWithSingleValuedPathExpression(
4252 public function testOrderWithArithmeticExpressionWithLiteralAndSingleValuedPathExpression (): void
4353 {
4454 $ dql = 'SELECT p ' .
45- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
46- 'ORDER BY 1 + p.id ASC ' ;
55+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
56+ 'ORDER BY 1 + p.id ASC ' ;
4757
4858 /** @var CompanyEmployee[] $result */
4959 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -56,8 +66,8 @@ public function testOrderWithArithmeticExpressionWithLiteralAndSingleValuedPathE
5666 public function testOrderWithArithmeticExpressionWithLiteralAndSingleValuedPathExpression2 (): void
5767 {
5868 $ dql = 'SELECT p ' .
59- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
60- 'ORDER BY ((1 + p.id)) ASC ' ;
69+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
70+ 'ORDER BY ((1 + p.id)) ASC ' ;
6171
6272 /** @var CompanyEmployee[] $result */
6373 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -70,8 +80,8 @@ public function testOrderWithArithmeticExpressionWithLiteralAndSingleValuedPathE
7080 public function testOrderWithArithmeticExpressionWithSingleValuedPathExpressionAndLiteral (): void
7181 {
7282 $ dql = 'SELECT p ' .
73- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
74- 'ORDER BY p.id + 1 ASC ' ;
83+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
84+ 'ORDER BY p.id + 1 ASC ' ;
7585
7686 /** @var CompanyEmployee[] $result */
7787 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -83,9 +93,11 @@ public function testOrderWithArithmeticExpressionWithSingleValuedPathExpressionA
8393
8494 public function testOrderWithArithmeticExpressionWithResultVariableAndLiteral (): void
8595 {
86- $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
87- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
88- 'ORDER BY s + 1 DESC ' ;
96+ $ this ->skipIfPostgres (__FUNCTION__ );
97+
98+ $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
99+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
100+ 'ORDER BY s + 1 DESC ' ;
89101
90102 /** @var CompanyEmployee[] $result */
91103 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -97,9 +109,11 @@ public function testOrderWithArithmeticExpressionWithResultVariableAndLiteral():
97109
98110 public function testOrderWithArithmeticExpressionWithResultVariableAndLiteral2 (): void
99111 {
100- $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
101- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
102- 'ORDER BY ((s + 1)) DESC ' ;
112+ $ this ->skipIfPostgres (__FUNCTION__ );
113+
114+ $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
115+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
116+ 'ORDER BY ((s + 1)) DESC ' ;
103117
104118 /** @var CompanyEmployee[] $result */
105119 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -111,9 +125,11 @@ public function testOrderWithArithmeticExpressionWithResultVariableAndLiteral2()
111125
112126 public function testOrderWithArithmeticExpressionWithLiteralAndResultVariable (): void
113127 {
114- $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
115- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
116- 'ORDER BY 1 + s DESC ' ;
128+ $ this ->skipIfPostgres (__FUNCTION__ );
129+
130+ $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
131+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
132+ 'ORDER BY 1 + s DESC ' ;
117133
118134 /** @var CompanyEmployee[] $result */
119135 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -125,9 +141,11 @@ public function testOrderWithArithmeticExpressionWithLiteralAndResultVariable():
125141
126142 public function testOrderWithArithmeticExpressionWithLiteralAndResultVariable2 (): void
127143 {
128- $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
129- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
130- 'ORDER BY ((1 + s)) DESC ' ;
144+ $ this ->skipIfPostgres (__FUNCTION__ );
145+
146+ $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
147+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
148+ 'ORDER BY ((1 + s)) DESC ' ;
131149
132150 /** @var CompanyEmployee[] $result */
133151 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -139,9 +157,11 @@ public function testOrderWithArithmeticExpressionWithLiteralAndResultVariable2()
139157
140158 public function testOrderWithArithmeticExpressionWithResultVariableAndSingleValuedPathExpression (): void
141159 {
142- $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
143- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
144- 'ORDER BY s + p.id DESC ' ;
160+ $ this ->skipIfPostgres (__FUNCTION__ );
161+
162+ $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
163+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
164+ 'ORDER BY s + p.id DESC ' ;
145165
146166 /** @var CompanyEmployee[] $result */
147167 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -153,9 +173,11 @@ public function testOrderWithArithmeticExpressionWithResultVariableAndSingleValu
153173
154174 public function testOrderWithArithmeticExpressionWithResultVariableAndSingleValuedPathExpression2 (): void
155175 {
156- $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
157- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
158- 'ORDER BY ((s + p.id)) DESC ' ;
176+ $ this ->skipIfPostgres (__FUNCTION__ );
177+
178+ $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
179+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
180+ 'ORDER BY ((s + p.id)) DESC ' ;
159181
160182 /** @var CompanyEmployee[] $result */
161183 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
@@ -167,9 +189,11 @@ public function testOrderWithArithmeticExpressionWithResultVariableAndSingleValu
167189
168190 public function testOrderWithArithmeticExpressionWithSingleValuedPathExpressionAndResultVariable (): void
169191 {
170- $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
171- 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
172- 'ORDER BY p.id + s DESC ' ;
192+ $ this ->skipIfPostgres (__FUNCTION__ );
193+
194+ $ dql = 'SELECT p, p.salary AS HIDDEN s ' .
195+ 'FROM Doctrine\Tests\Models\Company\CompanyEmployee p ' .
196+ 'ORDER BY p.id + s DESC ' ;
173197
174198 /** @var CompanyEmployee[] $result */
175199 $ result = $ this ->_em ->createQuery ($ dql )->getResult ();
0 commit comments