Use DI in block renderer

[MAILPOET-2899]
This commit is contained in:
Pavel Dohnal
2020-05-25 13:51:37 +02:00
committed by Veljko V
parent 7561730407
commit 5f73f9ee3e
5 changed files with 32 additions and 31 deletions

View File

@ -7,7 +7,7 @@ use MailPoet\WP\Functions as WPFunctions;
class AutomatedLatestContentTest extends \MailPoetTest {
public function testItGetsPostTypes() {
$endpoint = new AutomatedLatestContent(new \MailPoet\Newsletter\AutomatedLatestContent(), new WPFunctions);
$endpoint = $this->diContainer->get(AutomatedLatestContent::class);
$response = $endpoint->getPostTypes();
expect($response->data)->notEmpty();
foreach ($response->data as $postType) {
@ -18,7 +18,7 @@ class AutomatedLatestContentTest extends \MailPoetTest {
}
public function testItDoesNotGetPostTypesExludedFromSearch() {
$endpoint = new AutomatedLatestContent(new \MailPoet\Newsletter\AutomatedLatestContent(), new WPFunctions);
$endpoint = $this->diContainer->get(AutomatedLatestContent::class);
$response = $endpoint ->getPostTypes();
// WP's default post type 'revision' is excluded from search
// https://codex.wordpress.org/Post_Types