Commit Graph

113 Commits

Author SHA1 Message Date
Rostislav Wolny
cd5a023b35 Move onSettingsChange from Bridge service to SettingsChangeHandler
Bridge is a low level service that processes requests and responses to/from Bridge API.
This change is needed so that we can remove dependency on MailPoet\Util\License\Features\Subscribers
service from the Bridge. The dependecy is a higher level service and may easily cause a circular dependency issue.

The SettingsChangeHandler is service for handling side effects
when saving settings. This feels as a better place to put the functionality.
[MAILPOET-5191]
2023-05-10 13:05:37 +02:00
Rostislav Wolny
6c2cda36b0 Run custom field data through sanitizer when saving via API
[MAILPOET-5241]
2023-04-24 13:26:31 +02:00
John Oleksowicz
e7f766aedf Remove empty _afters
MAILPOET-5145
2023-04-07 12:11:12 -05:00
John Oleksowicz
376dca1098 Remove unnecessary truncating
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
Brezo Cordero
685af267cb Use constant, improve test and naming
[MAILPOET-5131]
2023-04-03 12:57:31 +02:00
Brezo Cordero
c0eed5b919 Integration tests for provisioning
[MAILPOET-5131]
2023-04-03 12:57:31 +02:00
Rodrigo Primo
c507229dd2 Add unsubscribe API method
It can be used by calling:

```
$mailpoet_api = \MailPoet\API\API::MP('v1');
$mailpoet_api->unsubscribe($subscriberId);
```

[MAILPOET-5152]
2023-03-27 19:25:49 +02:00
Rodrigo Primo
d37b961c2b Use getServiceWithOverrides() to create an instance of Subscribers
By using this helper method, we don't need to change the code that
instantiate Subscribers whenever the class signature changes as it is
going to happen in a subsequent commit.

[MAILPOET-5152]
2023-03-27 19:25:49 +02:00
Sam Najian
0795c2ffff Expose the log for corrupted newsletter on listing page
[MAILPOET-4983]
2023-03-01 17:46:22 +01:00
Rodrigo Primo
678911a8bc Fix PHPStan baseline errors in a few integration test files
[MAILPOET-4037]
2023-02-23 14:13:17 +01:00
David Remer
623010a644 Use dataprovider and clean up early
[MAILPOET-4883]
2023-02-15 12:30:41 +01:00
David Remer
95ec3d2fb9 Add integration test to ensure posts are probperly fetched
[MAILPEOT-4883]
2023-02-15 12:30:41 +01:00
Rodrigo Primo
ad4247a241 Add API endpoint to delete a setting
[MAILPOET-4814]
2023-01-30 15:01:42 +01:00
Jan Lysý
40f4216ff8 Add method for getting WC coupons
[MAILPOET-4761]
2023-01-30 09:36:21 +01:00
Jan Lysý
e4029a607a Adopt logging test to warning instead of error
[MAILPOET-4639]
2023-01-09 15:23:48 +01:00
Jan Lysý
2200411455 Add test case for logged error
[MAILPOET-4104]
2023-01-09 15:23:48 +01:00
Jan Lysý
b0ab2f404f Add logging errors to the log table
[MAILPOET-4104]
2023-01-09 15:23:48 +01:00
David Remer
5802f2132d Use badRequest method instead of throwing an InvalidState exception
[PREMIUM-213]
2022-12-16 14:11:34 +01:00
David Remer
8e502e5f50 Rename save method to create
[PREMIUM-213]
2022-12-16 14:11:34 +01:00
David Remer
8457aa7e2b Remove ToDo comments
[PREMIUM-213]
2022-12-16 14:11:34 +01:00
David Remer
5b93b88f46 Add Tags endpoint
[PREMIUM-213]
2022-12-16 14:11:34 +01:00
Oluwaseun Olorunsola
c4bd2acd84 Update tests
MAILPOET-4649
2022-12-15 18:15:01 +01:00
Jan Jakes
82aeb89854 Use strict types in tests
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
David Remer
8c5222d850 Fix WordPress.Security.ValidatedSanitizedInput.InputNotSanitized and related errors
[MAILPOET-4850]
2022-11-28 22:54:13 +03: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
David Remer
4832771185 Refactor the captcha system
The current Captcha class has a lot of responsibilities. It renders the captcha
image, can check if a certain captcha type is a Google captcha, if a captcha is
required for a certain email. The SubscriberSubscribeController is not only in
charge of "controlling" the subscription process but also validates, whether a
captcha is correct or not. This architecture made it difficult to extend the
functionality and introduce the audio captcha feature.

Therefore this commit refactors the captcha architecture and tries to seperate
the different concerns into several classes and objects. Validation is now done
by validators.

The CaptchaPhrase now is in charge of keeping the captcha phrase consistent
between the image and the new audio, so that you can renew the captcha and both
captchas are in sync.

[MAILPOET-4514]
2022-11-24 09:20:39 +01:00
Jan Jakes
d1df2d4f42 Add a helper function to create new table
[MAILPOET-4835]
2022-11-21 12:15:10 +01:00
Jan Jakes
c748b80447 Fix timestamp column problems with some MySQL versions and some SQL modes
[MAILPOET-4788]
2022-11-14 12:35:29 +02:00
Jan Jakes
725e0ecb00 Remove automation feature flag
[MAILPOET-4788]
2022-11-14 12:35:29 +02:00
Jan Jakes
2e328b6d7f Move temporary automation migrator to a new migration
[MAILPOET-4788]
2022-11-14 12:35:29 +02:00
Jan Jakes
a60562254c Temporarily fix reinstall test wiping out automation tables
[MAILPOET-4466]
2022-11-07 10:05:42 +01:00
Jan Jakes
9730fb9272 Move the old dbDelta-based migrator to a migration
This will ensure it runs once and from there, it will continue using the new migrations.

[MAILPOET-4466]
2022-11-07 10:05:42 +01:00
Jan Jakes
f65821256c Run migrations on activation
[MAILPOET-4466]
2022-11-07 10:05:42 +01:00
Jan Lysý
8161b83ded Add check on list type when deleting list
[MAILPOET-4752]
2022-11-02 14:05:39 +01:00
Jan Lysý
ad46d05c6b Add check on list type
[MAILPOET-4752]
2022-11-02 14:05:39 +01:00
Jan Lysý
f231f3dc6d Fix type error for list update
[MAILPOET-4752]
2022-11-02 14:05:39 +01:00
Jan Lysý
f6a5e0117c Add deleteList test cases
[MAILPOET-4752]
2022-11-02 14:05:39 +01:00
Jan Lysý
94a2e54c1e Add test cases for updateList
[MAILPOET-4752]
2022-11-02 14:05:39 +01:00
Sam Najian
0f45727ddc Add a new test case when verifying creator key with API
[MAILPOET-4464]
2022-10-17 12:15:07 +02:00
Jan Lysý
8f38dc451e Add test cases for MP API getSubscribersCount
[MAILPOET-4717]
2022-10-17 09:12:10 +02:00
Rostislav Wolny
b96b549f43 Unschedule cron actions before running migrations
We don't want to run any actions during migrations.
This will also clean duplicate trigger actions
that were potentially created because of requests race conditions.
[MAILPOET-4684]
2022-10-13 14:21:43 +02:00
Jan Lysý
66000fada4 Add test cases for MP API getSubscribers
[MAILPOET-4716]
2022-10-13 11:12:10 +02:00
Jan Lysý
296a47f8e7 Add new API method getSubscribers
[MAILPOET-4716]
2022-10-13 11:12:10 +02:00
Jan Lysý
f1b59173dd Add filters into newsletter response
[MAILPOET-4583]
2022-10-05 14:14:34 +02:00
Jan Lysý
7e6f708df8 Create tags when do not exist
[MAILPOET-4557]
2022-09-28 11:42:51 +02:00
Rodrigo Primo
ef66a21096 Remove old ScheduledTask model from Config\Populator
[MAILPOET-4306]
2022-09-26 14:18:01 +02:00
Oluwaseun Olorunsola
a006701d78 PR feedback: add type hints, create new methods and save on extra api request
MAILPOET-4601
2022-09-26 11:13:40 +02:00