1
0
mirror of synced 2025-02-02 21:41:45 +03:00

3570 Commits

Author SHA1 Message Date
Marco Pivetta
75bf197e11 #5689 moved OidReuseTest contents into the UnitOfWork tests 2016-09-10 20:15:33 +02:00
Mathieu De Zutter
44af69c5d2 Additional assertion to check that unreferenced objects are not in UOW. 2016-09-09 23:22:31 +02:00
Mathieu De Zutter
01d51bfca3 Avoid conflicts due to spl_object_hash().
When merging an entity with a to-many association, it will store the
original entity data using the object hash of the to-be-merged entity
instead of the managed entity. Since this to-be-merged entity is not
managed by Doctrine, it can disappear from the memory. A new object
can reuse the same memory location and thus have the same object hash.
When one tries to persist this object as new, Doctrine will refuse it
because it thinks that the entity is managed+dirty.

This patch is a very naive fix: it just disables storing the original
entity data in case of to-many associations. It may not be the ideal
or even a good solution at all, but it solves the problem of object
hash reuse.

The test case relies on the immediate reusing of memory locations by
PHP. The variable $user has twice the same object hash, though referring
a different object. Tested on PHP 5.6.17

Without the fix, the test fails on the last line with:
A managed+dirty entity Doctrine\Tests\Models\CMS\CmsUser@[...] can not
be scheduled for insertion.
2016-09-09 23:22:31 +02:00
Luís Cobucci
b431332cef Evict query cache when entities are updated 2016-09-08 13:50:06 +02:00
Luís Cobucci
16a3a2a132 Use microtime to have more precision on cache time 2016-09-08 13:50:06 +02:00
Carl Vuorinen
43d22984ae Add unit test for SimpleObjectHydrator 2016-09-08 13:37:00 +02:00
Carl Vuorinen
d2cbd5e872 PR fixes (public properties & correct letter case in annotations) 2016-09-08 13:37:00 +02:00
Carl Vuorinen
12b5e79ff2 Create a failing test for issue #5989
Field with type=simple_array in a joined inheritance gets overridden by empty array in the hydrator
2016-09-08 13:37:00 +02:00
Javier Spagnoletti
a90035e81a Expose EntityPersister::count() through EntityRepository::count() 2016-09-08 00:32:15 +02:00
Marco Pivetta
50f321f2e9 #5975 minor test cleanups 2016-09-07 23:18:39 +02:00
Alexander Kurilo
74ec055d57 Use ::class const instead of FQCN string (#5762) 2016-09-07 23:15:00 +02:00
Alexander Kurilo
c6ea8b1129 Remove irrelevant accessors (#5762) 2016-09-07 23:15:00 +02:00
John Keller
3bec698fed add functional test and bug fix for issue #5762 2016-09-07 23:15:00 +02:00
Carl Vuorinen
0da6669fac Fix functional test query logger
DebugStack starts queries array from index 1 rather than 0 so the last query was never printed.
Also array params caused an 'Array to string conversion' error
2016-09-03 23:52:34 +03:00
Marco Pivetta
44feacd327 Corrected SLC test expected query count: since the identity map is now consistently hashing identifiers 2016-07-07 23:46:09 +02:00
Marco Pivetta
d330da898f Correcting order of deletes: cache_token relies on cache_complex_action 2016-07-07 22:24:37 +02:00
Marco Pivetta
5d12593e70 Rewrote ManyToOne SLC tests to not rely on multi-level auto-generated identifiers
Background:

Test relied on an `A->B->C` association:

 * `A#id` being `B`
 * `B#id` being `C`
 * `C#id` being an auto-generated identifier (post-insert)

This cannot work, because it breaks the UnitOfWork's identity map.
Specifically, no entries for `A` and `B` can exist in the identity map until `C` entries
are persisted (post-insert).

That means that the identifier generator for `A` and `B` should not be an "assigned"
generator, but should instead be a post-insert generator waiting for other entities
to be persisted.

We cannot fix this in ORM 2.x, but we'll need to invent something for 3.x in order to
fix that (directed graph, or caching the order of operations in the metadata graph).
2016-07-07 21:29:10 +02:00
Marco Pivetta
0d82128b2e Registering a managed entity with an empty identifier is to be disallowed 2016-07-07 20:57:02 +02:00
Marco Pivetta
7544934158 Removing note that is not valid anymore 2016-07-07 20:39:52 +02:00
Marco Pivetta
2829174267 Simplified test: invalid entities must make it in the UnitOfWork manually, via registerManaged 2016-07-07 20:28:21 +02:00
Marco Pivetta
5b8b548bd4 When invalid (null) identifiers are provided, an exception should be thrown 2016-07-07 20:08:24 +02:00
Marco Pivetta
9abccba109 When invalid (null) identifiers are provided, an exception should be thrown 2016-07-07 19:58:43 +02:00
Marco Pivetta
da7582d329 Typo fix: s/$booleanTrue/$booleanFalse (C&P mistake) 2016-07-07 19:43:03 +02:00
Marco Pivetta
aa1fda6d5f Checking for boolean true/false identifiers 2016-07-07 19:38:48 +02:00
Marco Pivetta
29d9f344e8 Non-empty composite key identifiers should also be supported 2016-07-07 19:35:39 +02:00
Marco Pivetta
549bfe127c Correcting test case: expecting identifier hashes to support empty strings 2016-07-07 19:34:24 +02:00
Marco Pivetta
12789ee6ca Basic tests around addToIdentityMap with valid string identifiers (empty string allowed) 2016-07-07 19:27:49 +02:00
Marco Pivetta
18e3cb4440 #5867 @group annotations, describing scenario 2016-06-19 12:44:19 +02:00
Marco Pivetta
aa8cf7bae9 #5867 simplifying test case by inlining all required models into the test case 2016-06-19 12:42:49 +02:00
Luís Cobucci
27f3bc1e2c Allow the usage of embedded objects on parent classes.
The `ClassMetadataInfo` was always using the "current class" to
fetch the reflection of a property even when a field is declared
on the parent class (which causes `ReflectionProperty` to throw
an exception).
2016-06-19 12:35:57 +02:00
Marco Pivetta
765e102d01 Merge pull request #5856 from doctrine/fix/#5854-default-query-cache-test-using-wrong-reflection-instance
#5854 workaround to avoid populating Second Level Cache from DQL queries with multiple nested DQL aliases
2016-06-19 08:48:38 +02:00
Sebastian Bergmann
9da83cfae8 Make test suite compatible with PHPUnit 5.4.
* Use createMock() and getMockBuilder() instead of getMock()
* Use expectException() and expectExceptionMessage() instead of setExpectedException()
2016-06-18 13:01:59 +02:00
FabioBatSilva
163dac4a91 #5854 - Fix SLC queries with multiple nested DQL aliases 2016-06-17 00:11:18 -04:00
Marco Pivetta
be090e2f75 #5854 removing failure caused by a ReflectionProperty being instantiated against the wrong class name in a test 2016-06-16 23:00:59 -04:00
Thomas Ploch
ea788fb734 Exporters should only inspect joinColumns for owning side in bi-directional OneToOne
rebased commits:

- Added test case for bi-directional OneToOne in YamlExporter
- Only inspect joinColumns for owning side in bi-directional OneToOne in YamlExporter
- Adding bi-directional test case without joinColumn to XmlExporter test
- Same testcase also applied to PhpExporter
- Fixing bi-directional issue in PhpExporter when inspecting joinColumns index
- Implemented @Ocramius suggestions
2016-06-08 13:24:43 +02:00
Marco Pivetta
34d8e00df7 #5849 #5850 correcting test scenario: identity map could not be built with auto-generated identities+persist 2016-06-06 00:08:26 +02:00
Marco Pivetta
313e4a33e5 #5849 #5850 adding group annotations to the newly introduced test case 2016-06-05 23:54:16 +02:00
Rico Humme
3df494ddc8 Test Case for Clear entityInsertions for specific entityName 2016-06-05 23:16:09 +02:00
Luís Otávio Cobucci Oblonczyk
2c1818d513 Fix typo 2016-06-05 10:25:08 +00:00
Mikhail Shamin
b173763bbb Remove full qualified class names in tests 2016-05-11 03:00:44 +07:00
Mikhail Shamin
bf322b903d Optimize imports. Remove full qualified class names 2016-05-11 01:55:12 +07:00
Matteo Beccati
82588c0af9 Fixed test failing due to changes in AnnotationReader
Doctrine\Tests\ORM\Mapping\AnnotationDriverTest::testLoadMetadataForNonEntityThrowsException
Argument 1 passed to Doctrine\Common\Annotations\AnnotationReader::__construct() must be an instance of Doctrine\Common\Annotations\DocParser, instance of Doctrine\Common\Cache\ArrayCache given, called in .../tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php on line 19 and defined

See: https://revive.beccati.com/bamboo/browse/PHP-DOCTR-PHP55-646/test/case/11813971
2016-02-29 11:06:23 +01:00
Guilherme Blanco
9b4c50e81e Final work around entity changeset fix 2016-02-16 05:03:11 +00:00
Patrick Poulain
9461839d42 Fix PostgreSql Tests 2016-02-15 21:07:09 +01:00
Patrick Poulain
e8296e8e7d Fix ORM Driver Tests 2016-02-15 21:06:34 +01:00
Patrick Poulain
cbde629bf0 Fix MySql Tests 2016-02-15 21:06:01 +01:00
jeremygiberson@gmail.com
dd64161ece forgot to delete from relational table first 2016-02-14 18:00:15 -07:00
jeremygiberson@gmail.com
cc7ef71a13 added teardown for new cmstag table 2016-02-14 17:48:53 -07:00
jeremygiberson@gmail.com
1e660abeb8 cascade all operations on cmstags 2016-02-14 17:43:58 -07:00
jeremygiberson@gmail.com
3ed64dcec2 changed relation table column name to match 2016-02-14 17:37:25 -07:00