Commit Graph

48 Commits

Author SHA1 Message Date
Rostislav Wolny
5fdba0e170 Replace current_time usage in tests
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
 Ján Mikláš
f5ae03a5a6 Update import/export tests to account for WP and WC lists
[MAILPOET-3977]
2024-06-12 12:13:37 +02:00
Mike Jolley
0d6fe6e5eb Apply rules to tests and tasks 2024-03-21 16:57:59 +01:00
Rodrigo Primo
f0434d74e7 Ensure Doctrine entity cache is cleared after changing the database
ImportExportRepository::updateMultiple() changes subscribers by running
MySQL queries directly. Now that \MailPoet\Segments\WP uses Doctrine as
well this was causing a bug caught by our integration tests.

```
MailPoet\Subscribers\ImportExport\Import\ImportTest::testItSynchronizesWpUsers
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'mary'
+'Mary'

/wp-core/wp-content/plugins/mailpoet/tests/integration/Subscribers/ImportExport/Import/ImportTest.php:719
```

https://app.circleci.com/pipelines/github/mailpoet/mailpoet/16386/workflows/c3fa0cf4-a77d-41ab-a5cc-78d4b37d9228/jobs/278066/tests#failed-test-0

This test was failing because the Doctrine entities were not updated
after the import process ran and modified the subscribers directly in
the database. Running EntityManager::clear() after importing the
subscribers, forces Doctrine to query the database again to update the
entities and prevents this bug.

[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
alex-mpoet
5824905f18 Independently update existing subscribers info and status in import
[MAILPOET-5617]
2024-02-05 12:54:02 +01:00
Rodrigo Primo
eb8351f964 Replace verify()->equals() with verify->equalsWithDelta()
The second parameter of expect()->equals() could be a integer and in
this case it would be used as a delta when comparing the values.
verify()->equals() does not accept that and verify()->equalsWithDelta()
should be used.

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
e4f0b89032 Replace expect()->contains() with verify()->arrayContains()
codeception/verify 2.1 removed support for expect()->contains() so we need
to replace it with verify()->arrayContains().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
a1f57361c5 Replace expect()->array() with verify()->isArray()
codeception/verify 2.1 removed support for expect()->array() so we need
to replace it with verify()->isArray().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
9b56fdc688 Replace expect()->count() with verify()->arrayCount()
codeception/verify 2.1 removed support for expect()->count() so we need
to replace it with verify()->arrayCount().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
e4136fee8c Replace expect()->isEmpty() with verify()->empty()
codeception/verify 2.1 removed support for expect()->isEmpty() so we need
to replace it with verify()->empty().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
1865fc8930 Replace expect()->isInstanceOf() with verify()->instanceOf()
codeception/verify 2.1 removed support for expect()->isInstanceOf() so we need
to replace it with verify()->instanceOf().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
5bc5b5ebd2 Replace expect()->notEmpty() with verify()->notEmpty()
codeception/verify 2.1 removed support for expect()->notEmpty() so we need
to replace it with verify()->notEmpty().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
00c5250cff Replace expect()->notEquals() with verify()->notEquals()
codeception/verify 2.1 removed support for expect()->notEquals() so we need
to replace it with verify()->notEquals().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
a70067a34c Replace expect()->hasKey() with verify()->arrayHasKey()
codeception/verify 2.1 removed support for expect()->hasKey() so we need
to replace it with verify()->arrayHasKey().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
0d2f6e0776 Replace expect()->stringContainsString() with verify()->stringContainsString()
codeception/verify 2.1 removed support for expect()->stringContainsString() so we need
to replace it with verify()->stringContainsString().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
709be1d541 Replace expect()->null() with verify()->null()
codeception/verify 2.1 removed support for expect()->null() so we need
to replace it with verify()->null().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
997f635d4a Replace expect()->false() with verify()->false()
codeception/verify 2.1 removed support for expect()->false() so we need
to replace it with verify()->false().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
9adbf81a78 Replace expect()->true() with verify()->true()
codeception/verify 2.1 removed support for expect()->true() so we need
to replace it with verify()->true().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
afe378ba22 Replace expect()->equals() with verify()->equals()
codeception/verify 2.1 removed support for expect()->equals() so we need
to replace it with verify()->equals().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00
Rodrigo Primo
bcf57de500 Remove remaining uses of Subscriber model in SubscriberExporterTest
[MAILPOET-5361]
2023-05-30 11:16:46 -05:00
Rodrigo Primo
1c0f5af55c Remove remaining uses of CustomField model in SubscriberExporterTest
[MAILPOET-5361]
2023-05-30 11:16:46 -05:00
alex-mailpoet
4f1afa388f Clean up transient cache in tests where necessary
[MAILPOET-5180]
2023-05-22 14:13:05 +02:00
Rodrigo Primo
00d021109c Move ModelValidator::validateNonRoleEmail() to a new Validator class
We want to remove/refactor the whole ModelValidator class as part of the
Doctrine refactor.

This commit moves the method ModelValidator::validateNonRoleEmail() to a
new Validator class as the method is not used by the validator system of
the Paris models. ModelValidator::validateEmail() was also moved as it
is called by ModelValidator::validateNonRoleEmail().

[MAILPOET-4343]
2023-05-17 12:37:22 +02:00
Jan Jakes
70e6447e28 Extract WPFunctions reset to test bootstrap
MAILPOET-5145
2023-04-07 12:11:12 -05:00
Jan Jakes
81274b1691 Replace hardcoded custom field ID with the actual one
MAILPOET-5145
2023-04-07 12:11:12 -05:00
Jan Jakes
c1babe49db Remove more no longer necessary test cleanups
MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
cf67ad2a83 Add missing parent::_after calls
MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
cd0b795ac8 Extract customer creation/cleanup
This also ensures that cleanup always runs after all integration tests

MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
c75bc388c9 Remove unnecessary cleanup code
MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
57eb438eb8 Don't assume auto increment of 1
MAILPOET-5145
2023-04-07 12:11:12 -05:00
Rodrigo Primo
775ab32037 Fix PHPStan baseline errors in a few test files
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
Jan Jakes
82aeb89854 Use strict types in tests
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
David Remer
7db40b27b5 Fix errors automatically with phpcbf
[MAILPOET-4850]
2022-11-28 22:54:13 +03:00
David Remer
d2ec7bba42 Replace instance_of asserts in integration tests
[MAILPOET-4258]
2022-11-25 14:32:34 +01:00
Jan Lysý
ba81018a9d Add test for tagging imported subscribers
[MAILPOET-4558]
2022-09-15 11:26:10 +02:00
Jan Lysý
5c57dd2006 Add saving tags for imported subscribers
[MAILPOET-4558]
2022-09-15 11:26:10 +02:00
Sam Najian
b2718940df Remove models from SegmentsExporterTest
[MAILPOET-4348]
2022-08-01 14:18:59 +02:00
Sam Najian
3ef32787cc Remove models from NewslettersExporterTest
[MAILPOET-4348]
2022-08-01 14:18:59 +02:00
Sam Najian
5b0e7128c6 Remove usages of StatisticsNewsletters in newsletter exporter
[MAILPOET-4348]
2022-08-01 14:18:59 +02:00
Sam Najian
31aa18868b Remove traces of older models in PersonalDataExports namespace
[MAILPOET-4348]
2022-08-01 14:18:59 +02:00
Sam Najian
10d4eb5d7f Remove old models from SegmentsExporter
[MAILPOET-4348]
2022-08-01 14:18:59 +02:00
Sam Najian
a2f65bf647 Migrate PersonalDataExporters\NewslettersExporter to Doctrine
[MAILPOET-4348]
2022-07-18 16:47:48 +02:00
Brezo Cordero
94fe87008a Remove PHPStan level 6 errors from Import
Remove the following errors from Subscribers\ImportExport\Import\MailChimp:
(Method|Property|Function) has no (return )?type specified.
(Method|Function) has parameter with no type (specified).

[MAILPOET-3720]
2022-05-25 09:43:47 +02:00
Brezo Cordero
34ce6cd329 Remove PHPStan level 6 errors from Import
Remove the following errors from Subscribers\ImportExport\Import\Import:
(Method|Property|Function) has no (return )?type specified.
(Method|Function) has parameter with no type (specified).

I have also added a few checks when using count and typed the arrays when possible.

[MAILPOET-3720]
2022-05-25 09:43:47 +02:00
Rodrigo Primo
30d44186bd Refactor ImportExportFactoryTest to use Doctrine instead of Paris
[MAILPOET-4139]
2022-05-23 11:37:26 +02:00
Rodrigo Primo
e6dd8fedbf Replace old model StatisticsOpens in OpensTest and NewslettersExporterTest
[MAILPOET-4150]
2022-05-13 08:45:28 +02:00
Jan Jakes
ab27eaee2d Autoformat files with prettier
[MAILPOET-4075]
2022-04-12 15:38:27 +02:00
Jan Jakes
9f790efbf0 Move plugin files to a subfolder
[MAILPOET-3988]
2022-01-18 15:30:22 +01:00