Commit Graph

50 Commits

Author SHA1 Message Date
Rostislav Wolny
5049aa3a24 Fix flaky TimestampListenerTest
The problem was that the listener was replaced in the EntityManager only
in the firs test case. For other test cases replaceListeners didn't replaced
anything because the original listener was not set.
This commit fixes the issue by setting the original listener back in the _after method.
[MALPOET-3983]
2021-12-09 15:17:16 +01:00
Rodrigo Primo
c701f02d27 Pass a copy of the Carbon object to avoid unexpected side effects
This commit changes LastSubscribedAtListener to pass a copy of the Carbon
object representing the current time to the SubscriberEntity property
lastSubscribedAt. Passing a copy instead of the object itself is needed to
avoid unexpected side effects. Before this change, modifying the time
of this property of a given SubscriberEntity instance could affect the
same field of another instance as the same object used inside
LastSubscribedAtListener for all entities.

[MAILPOET-3946]
2021-11-22 10:52:58 +01:00
Rodrigo Primo
9e334a953a Add integration tests for LastSubscribedAtListener
This commit adds basic integration tests for the class
LastSubscribedAtListener since it had none and it will be modified in a
subsequent commit. A method from TimestampListenerTest was moved to a
base class since it can be reused in LastSubscribedAtTest.

[MAILPOET-3946]
2021-11-22 10:52:58 +01:00
Rodrigo Primo
2e050d7a32 Pass a copy of the Carbon object to avoid unexpected side effects
This commit changes TimestampListener to pass a copy of the Carbon
object representing the current time to the entity properties updatedAt
and createdAt. Passing a copy instead of the object itself is needed to
avoid unexpected side effects. Before this change, modifying the time
of the createdAt or updatedAt field of a given entity could affect the
same field of another entity as it could be the same object used inside
TimestampListener for all entities.

[MAILPOET-3870]
2021-11-22 09:58:49 +01:00
Rodrigo Primo
12e326596d Remove unused imported classes from TimestampListenerTest
Found this while working on [MAILPOET-3870]
2021-11-22 09:58:49 +01:00
Rostislav Wolny
b8d72522a2 Replace deprecated doctrine methods in tests directory
[MAILPOET-3889]
2021-10-28 15:44:18 +02:00
Rostislav Wolny
503283fa63 Provide array cache implementation
doctrine/cache 2.0 no longer provides implementations of caches. It provides only interfaces.
We need only PHP array cache so I chose to implement this simple cache instead of introducing
new cache library.
[MAILPOET-3892]
2021-10-28 15:44:18 +02:00
Rostislav Wolny
ff42762f93 Remove custom PDO driver
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00
Rostislav Wolny
8af9b412ad Switch to built in PDO driver
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00
Rostislav Wolny
c9603b76dc Update doctrine packages and fix metadata cache
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00
Pavel Dohnal
86e89f7fc1 Add a port test
[MAILPOET-3580]
2021-05-24 13:23:41 +02:00
Pavel Dohnal
ea1a946a7b Use WP connection db port if missing in config
[MAILPOET-3580]
2021-05-24 13:23:41 +02:00
Jan Lysý
8573d99441 Replace timeListener in tests instead of creating new
[MAILPOET-3031]
2021-03-29 15:22:53 +02:00
Jan Lysý
fd5a9904c0 Add listener for updating lastSubscribedAt
[MAILPOET-3031]
2021-03-29 15:22:53 +02:00
Rostislav Wolny
dd3538b78d Add basic tests for PDOConnection and PDOStatement
[MAILPOET-3296]
2020-12-07 11:36:01 +01:00
Rostislav Wolny
12cc818f8b Fix required after optional parameter in doctrine config factory
[MAILPOET-3296]
2020-12-07 11:36:01 +01:00
Pavel Dohnal
a751a2a459 Add custom Doctrine Driver
[MAILPOET-3150]
2020-11-16 09:41:13 +01:00
Rostislav Wolny
54727ad9a2 Fix integration tests to work with updated codeception/verify
[MAILPOET-3203]
2020-10-20 13:18:43 +02:00
Rostislav Wolny
7019377ce7 Fix entityManager:flush deprecated calls
[MAILPOET-3146]
2020-10-08 15:59:05 +02:00
Rostislav Wolny
96f2bfaa20 Add entity lifecycle listener for emoji sanitisation
[MAILPOET-3196]
2020-10-06 17:36:44 +02:00
Rostislav Wolny
ae85e06afb Update integration tests
[MAILPOET-2630]
2020-07-29 13:50:54 +02:00
Jan Jakeš
fb238cd531 Fix errors discovered by doctrine-phpstan
[MAILPOET-2945]
2020-05-27 13:40:41 +02:00
Jan Jakeš
2ec85eee7b Fix mock naming and strings in integration tests
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
Jan Jakeš
d0292f8624 Convert variable names to camel case in PHPDoc
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
Jan Jakeš
7a66366ab5 Convert property names to camel case in strings
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
Jan Jakeš
3bbc8ea2af Convert variable names to camel case in strings
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
Jan Jakeš
8c848cfa28 Convert property names to camel case
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
Jan Jakeš
54549ff037 Convert variable names to camel case
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00
wxa
cde877122a Fix various undefined variables and argument types [MAILPOET-2488] 2019-12-30 14:51:22 +01:00
wxa
09a1411c81 Fix types with annotations [MAILPOET-2488] 2019-12-30 14:51:22 +01:00
Amine Ben hammou
43df66d162 Add public keyword to methods
[MAILPOET-2413]
2019-12-26 18:09:45 +03:00
Jan Jakeš
0e964de6d4 Move nesbot/carbon to vendor-prefixed
[MAILPOET-2560]
2019-12-15 21:55:48 +00:00
Rostislav Wolny
152d4c6251 Convert empty string to null in json type property
[MAILPOET-2504]
2019-10-29 15:17:29 +00:00
Jan Jakeš
59480cdfb2 Move ValidationException under Validator namespace
[MAILPOET-2437]
2019-10-24 11:03:09 +01:00
Jan Jakeš
2bdf8643fc Use factory to create Validator, reuse AnnotationReaderProvider
[MAILPOET-2437]
2019-10-24 11:03:09 +01:00
Jan Jakeš
68c1b62df5 Extract annotation reader setup to a provider class
[MAILPOET-2437]
2019-10-24 11:03:09 +01:00
Jan Jakeš
83286d64c4 Add test for Doctrine entity validation
[MAILPOET-2437]
2019-10-24 11:03:09 +01:00
Jan Jakeš
730f640cc3 Integrate symfony/validator with Doctrine entitites
[MAILPOET-2437]
2019-10-24 11:03:09 +01:00
Jan Jakeš
48802e47c4 Use namespaced Doctrine annotations
[MAILPOET-2437]
2019-10-24 11:03:09 +01:00
Jan Jakeš
3a8ffceeb9 Improve TimestampListernerTest to always use custom entity manager
[MAILPOET-2216]
2019-08-23 15:31:11 -04:00
Jan Jakeš
03fb82cf95 Add JSON and JSON/serialized types for Doctrine
[MAILPOET-2216]
2019-08-23 15:31:11 -04:00
Rostislav Wolny
9696588a1d Ignore empty charset for DB connection parameters
[MAILPOET-2240]
2019-07-31 08:34:56 -04:00
Jan Jakeš
6ede84af1b Use only array cache in Doctrine at the moment
[MAILPOET-2014]
2019-07-24 15:03:16 -04:00
Jan Jakeš
aa13de72cc Fix setup of socket and IPv6 connection
[MAILPOET-2014]
2019-07-24 15:03:16 -04:00
Jan Jakeš
11b166d018 Use WP timestamp in TimestampListener
[MAILPOET-2014]
2019-07-24 15:03:16 -04:00
Jan Jakeš
a07043cfb4 Add serializable DB connection wrapper
[MAILPOET-2014]
2019-07-24 15:03:16 -04:00
Jan Jakeš
4cbc89368c Add entity traits for created_at and updated_at fields
[MAILPOET-2014]
2019-07-24 15:03:16 -04:00
Jan Jakeš
fcccbf8358 Add test for Doctrine configuration factory 2019-07-24 15:03:16 -04:00
Jan Jakeš
765d21ed6b Add driver option & wait_timeout settings according to Database.php
[MAILPOET-2014]
2019-07-24 15:03:16 -04:00
Jan Jakeš
b5e92f4939 Add Doctrine Connection factory
[MAILPOET-2014]
2019-07-24 15:03:16 -04:00