Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
d197c814
Commit
d197c814
authored
Feb 11, 2010
by
beberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] DDC-318 - Committed 3 commented tests for Operators that fail however
parent
57ef5f5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
6 deletions
+54
-6
QueryDqlFunctionTest.php
tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php
+54
-6
No files found.
tests/Doctrine/Tests/ORM/Functional/QueryDqlFunctionTest.php
View file @
d197c814
...
...
@@ -63,14 +63,14 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase
public
function
testFunctionAbs
()
{
$
arg
=
$this
->
_em
->
createQuery
(
'SELECT m, ABS(m.salary * -1) AS abs FROM Doctrine\Tests\Models\Company\CompanyManager m'
)
$
result
=
$this
->
_em
->
createQuery
(
'SELECT m, ABS(m.salary * -1) AS abs FROM Doctrine\Tests\Models\Company\CompanyManager m'
)
->
getResult
();
$this
->
assertEquals
(
4
,
count
(
$
arg
));
$this
->
assertEquals
(
100000
,
$
arg
[
0
][
'abs'
]);
$this
->
assertEquals
(
200000
,
$
arg
[
1
][
'abs'
]);
$this
->
assertEquals
(
400000
,
$
arg
[
2
][
'abs'
]);
$this
->
assertEquals
(
800000
,
$
arg
[
3
][
'abs'
]);
$this
->
assertEquals
(
4
,
count
(
$
result
));
$this
->
assertEquals
(
100000
,
$
result
[
0
][
'abs'
]);
$this
->
assertEquals
(
200000
,
$
result
[
1
][
'abs'
]);
$this
->
assertEquals
(
400000
,
$
result
[
2
][
'abs'
]);
$this
->
assertEquals
(
800000
,
$
result
[
3
][
'abs'
]);
}
public
function
testFunctionConcat
()
...
...
@@ -203,6 +203,54 @@ class QueryDqlFunctionTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
assertEquals
(
'Jonathan W.'
,
$result
[
3
][
'str3'
]);
}
/*public function testOperatorAdd()
{
$result = $this->_em->createQuery('SELECT m, m.salary+2500 AS add FROM Doctrine\Tests\Models\Company\CompanyManager m')
->getResult();
$this->assertEquals(4, count($result));
$this->assertEquals(102500, $result[0]['op']);
$this->assertEquals(202500, $result[1]['op']);
$this->assertEquals(402500, $result[2]['op']);
$this->assertEquals(802500, $result[3]['op']);
}
public function testOperatorSub()
{
$result = $this->_em->createQuery('SELECT m, m.salary-2500 AS add FROM Doctrine\Tests\Models\Company\CompanyManager m')
->getResult();
$this->assertEquals(4, count($result));
$this->assertEquals(102500, $result[0]['op']);
$this->assertEquals(202500, $result[1]['op']);
$this->assertEquals(402500, $result[2]['op']);
$this->assertEquals(802500, $result[3]['op']);
}
public function testOperatorMultiply()
{
$result = $this->_em->createQuery('SELECT m, m.salary*2 AS op FROM Doctrine\Tests\Models\Company\CompanyManager m')
->getResult();
$this->assertEquals(4, count($result));
$this->assertEquals(200000, $result[0]['op']);
$this->assertEquals(400000, $result[1]['op']);
$this->assertEquals(800000, $result[2]['op']);
$this->assertEquals(1600000, $result[3]['op']);
}
public function testOperatorDiv()
{
$result = $this->_em->createQuery('SELECT m, (m.salary/0.5) AS op FROM Doctrine\Tests\Models\Company\CompanyManager m')
->getResult();
$this->assertEquals(4, count($result));
$this->assertEquals(200000, $result[0]['op']);
$this->assertEquals(400000, $result[1]['op']);
$this->assertEquals(800000, $result[2]['op']);
$this->assertEquals(1600000, $result[3]['op']);
}*/
protected
function
generateFixture
()
{
$manager1
=
new
CompanyManager
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment