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

3590 Commits

Author SHA1 Message Date
Marco Pivetta
3cd7b8c951 #5987 CS: spacing after ! (not) operator 2016-11-26 05:23:04 +01:00
Javier Spagnoletti
e2b198112e [minor] Add missing type hints, add strictness for some checks, remove some useless calls 2016-11-26 05:18:46 +01:00
Marco Pivetta
899393d3bb Merge pull request #6142 from mbeccati/php72-count-fix
Fix incompatibility w/ PHP7.2+
2016-11-26 04:56:39 +01:00
Luís Cobucci
6344fd34cb
Improving the documentation of enums as discriminators test
@Ocramius was too eager to merge stuff

Related to: https://github.com/doctrine/doctrine2/pull/6141
2016-11-23 19:20:47 +01:00
Luís Cobucci
1b39cd87ad
Allow using objects as discriminators 2016-11-23 18:56:36 +01:00
Matteo Beccati
39dcf3e4c6 Fix incompatibility w/ PHP7.2+
Mock_ParserResult_*::getParameterMappings() was returning null, which
was then passed to count() on Query.php:308, causing a "Parameter must
be an array or an object that implements Countable" error.
2016-11-22 07:42:06 +01:00
Luís Cobucci
317e86802d
Make child entity share the timestamp region with parent class 2016-11-20 19:27:53 +00:00
Marco Pivetta
e7856f90d8 Merge branch 'feature/#6136-better-exception-message-on-invalid-connection-object'
Close #6136
2016-11-18 09:21:18 +01:00
Marco Pivetta
d2643eeb8b #6136 Removed regex assertion - constant assertion is sufficient 2016-11-18 09:19:27 +01:00
SpacePossum
e37041aa94 Update message. 2016-11-18 08:06:11 +01:00
Alexander Guz
8d433cdb39 #6129 Fixed code style and @depends in test. 2016-11-17 21:05:58 +01:00
SpacePossum
f9a605f6ca Add details about invalid Connection passed at creation. 2016-11-17 17:23:22 +01:00
Alexander Guz
7bf206adb4 #6129 Moved test to AbstractMappingDriverTest. 2016-11-16 20:01:11 +01:00
Alexander Guz
8580f02c6a #6129 Use User::class to get metadata instead of string. 2016-11-16 18:07:58 +01:00
Alexander Guz
cdf4af5f27 Added unit test for boolean option values.
It fail now. In `XmlDriver::_parseOptions` we need somehow to maintain
a list of options, that are supposed to be boolean, and then call
`$this->evaluateBoolean()` on them.
2016-11-16 17:56:07 +01:00
Jefersson Nathan
dbe843fc4b
remove license from header of test files 2016-10-26 13:24:33 -03:00
Marco Pivetta
3fca33bdc4 #5768 #5755 cleaned up test scenario, using new mocking logic as per PHPUnit 5.4+ 2016-09-10 20:45:01 +02:00
Ed Hartwell Goose
67e205b36a Fixes #5755, uses '->getReflectionProperties()' instead of '->getReflectionClass()->getProperties()' to ensure all fields are copied, and adds test to confirm behaviour 2016-09-10 20:37:20 +02:00
Marco Pivetta
503b211a22 #5689 removed unused reflection access 2016-09-10 20:19:15 +02:00
Marco Pivetta
f8436b2165 #5689 removed OidReuseTest, which was moved to UnitOfWork tests 2016-09-10 20:15:59 +02:00
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