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
06513978
Commit
06513978
authored
Sep 05, 2009
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Added coverage to ticket #2478. Could not get it to fail
parent
5b0cc456
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
3 deletions
+38
-3
StandardEntityPersisterTest.php
...rine/Tests/ORM/Functional/StandardEntityPersisterTest.php
+38
-3
No files found.
tests/Doctrine/Tests/ORM/Functional/StandardEntityPersisterTest.php
View file @
06513978
...
...
@@ -2,9 +2,11 @@
namespace
Doctrine\Tests\ORM\Functional
;
use
Doctrine\Tests\Models\ECommerce\ECommerceCart
;
use
Doctrine\Tests\Models\ECommerce\ECommerceCustomer
;
use
Doctrine\Tests\Models\ECommerce\ECommerceProduct
;
use
Doctrine\Tests\Models\ECommerce\ECommerceCart
,
Doctrine\Tests\Models\ECommerce\ECommerceCategory
,
Doctrine\Tests\Models\ECommerce\ECommerceCustomer
,
Doctrine\Tests\Models\ECommerce\ECommerceProduct
;
use
Doctrine\ORM\Mapping\AssociationMapping
;
require_once
__DIR__
.
'/../../TestInit.php'
;
...
...
@@ -40,4 +42,37 @@ class StandardEntityPersisterTest extends \Doctrine\Tests\OrmFunctionalTestCase
$persister
->
load
(
array
(
'customer_id'
=>
$customer
->
getId
()),
$newCart
);
$this
->
assertEquals
(
'Credit card'
,
$newCart
->
getPayment
());
}
/**
* Ticket #2478 from Damon Jones (dljones)
*/
public
function
testAddPersistRetrieve
()
{
$category
=
new
ECommerceCategory
();
$category
->
setName
(
'Eletronics'
);
$product
=
new
ECommerceProduct
();
$product
->
setName
(
'MP3 Player Foo'
);
$category
->
addProduct
(
$product
);
$product2
=
new
ECommerceProduct
();
$product2
->
setName
(
'MP3 Player Bar'
);
$category
->
addProduct
(
$product2
);
$this
->
_em
->
persist
(
$category
);
$this
->
_em
->
flush
();
// He reported that using $this->_em->clear(); after flush fixes the problem.
// It should work out of the box. That's what we are testing.
$q
=
$this
->
_em
->
createQuery
(
'
SELECT c, p
FROM Doctrine\Tests\Models\ECommerce\ECommerceCategory c
LEFT JOIN c.products p
'
);
$res
=
$q
->
getResult
();
$this
->
assertEquals
(
1
,
count
(
$res
));
$this
->
assertEquals
(
2
,
count
(
$res
[
0
]
->
getProducts
()));
}
}
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