Refactor ALC endpoint to follow DI

[MAILPOET-1637]
This commit is contained in:
Rostislav Wolny
2018-11-14 22:46:04 +01:00
parent e0863e4b7e
commit 38e9d806b8
3 changed files with 12 additions and 11 deletions

View File

@ -6,8 +6,8 @@ use MailPoet\API\JSON\v1\AutomatedLatestContent;
class AutomatedLatestContentTest extends \MailPoetTest {
function testItGetsPostTypes() {
$router = new AutomatedLatestContent();
$response = $router->getPostTypes();
$endpoint = new AutomatedLatestContent(new \MailPoet\Newsletter\AutomatedLatestContent());
$response = $endpoint->getPostTypes();
expect($response->data)->notEmpty();
foreach($response->data as $post_type) {
expect($post_type)->count(2);
@ -17,8 +17,8 @@ class AutomatedLatestContentTest extends \MailPoetTest {
}
function testItDoesNotGetPostTypesExludedFromSearch() {
$router = new AutomatedLatestContent();
$response = $router->getPostTypes();
$endpoint = new AutomatedLatestContent(new \MailPoet\Newsletter\AutomatedLatestContent());
$response = $endpoint ->getPostTypes();
// WP's default post type 'revision' is excluded from search
// https://codex.wordpress.org/Post_Types
$revision_post_type = get_post_type_object('revision');