Files
piratepoet/tests/unit/Config/HooksTest.php
Fred. P 5912004c10 Fix: CPU usage and sending issue on slow host
On some slow host, the `newsletter` table get filled with
duplicated `notification_history` marked as `sending` that
never get sent.

To prevent this we've made the two following changes:
* We prevent firing `publis_*` hooks on post_type which
are excluded from search.
* We do not schedule a new post notification email if one
has an `notification_history` entry marked as `sending`.

[MAILPOET-1371]
2018-05-10 15:25:23 +02:00

15 lines
453 B
PHP

<?php
namespace MailPoet\Test\Config;
use MailPoet\Config\Hooks;
use MailPoet\WP\Posts as WPPosts;
class HooksTest extends \MailPoetTest {
function testItHooksSchedulerToMultiplePostTypes() {
$hooks = new Hooks();
$hooks->setupPostNotifications();
foreach(WPPosts::getTypes() as $post_type) {
expect(has_filter('publish_' . $post_type, '\MailPoet\Newsletter\Scheduler\Scheduler::schedulePostNotification'))->notEmpty();
}
}
}