subscriptionUrlFactory = $this->diContainer->get(SubscriptionUrlFactory::class); $subscriberFactory = new SubscriberFactory(); $this->subscriber = $subscriberFactory->create(); } public function testGetReEngagementUrlReturnsDefaultUrl() { $expectedUrl = '/?mailpoet_page=subscriptions&mailpoet_router&endpoint=subscription&action=re_engagement&data='; $this->assertStringContainsString($expectedUrl, $this->subscriptionUrlFactory->getReEngagementUrl($this->subscriber)); } public function testGetReEngagementUrlReturnsUrlToUserSelectedPage() { $settings = $this->diContainer->get(SettingsController::class); $postId = wp_insert_post([ 'post_title' => 'testGetReEngagementUrlReturnsUrlToUserSelectedPage', 'post_status' => 'publish', ]); $settings->set('reEngagement', ['page' => $postId]); $expectedUrl = get_permalink($postId); $this->assertIsString($expectedUrl, "Permalink is a valid string"); $this->assertStringContainsString($expectedUrl, $this->subscriptionUrlFactory->getReEngagementUrl($this->subscriber)); } public function _after() { parent::_after(); $this->truncateEntity(SettingEntity::class); } }