Use DI to create WooCommerce email

[MAILPOET-3924]
This commit is contained in:
Jan Jakes
2021-12-09 14:27:00 +01:00
committed by Veljko V
parent 9f32f05933
commit 3b85f89f3c
6 changed files with 62 additions and 50 deletions

View File

@@ -2,7 +2,10 @@
namespace MailPoet\API\JSON\v1;
use MailPoet\AutomaticEmails\AutomaticEmailFactory;
use MailPoet\AutomaticEmails\AutomaticEmails as AutomaticEmailsController;
use MailPoet\AutomaticEmails\WooCommerce\WooCommerce;
use MailPoet\WooCommerce\Helper;
use MailPoet\WP\Functions as WPFunctions;
class AutomaticEmailsTest extends \MailPoetTest {
@@ -13,7 +16,11 @@ class AutomaticEmailsTest extends \MailPoetTest {
public function _before() {
$this->wp = new WPFunctions;
$this->api = new AutomaticEmails(new AutomaticEmailsController($this->wp), $this->wp);
$automaticEmailFactory = $this->makeEmpty(AutomaticEmailFactory::class, [
'createWooCommerceEmail' => new WooCommerce($this->wp, new Helper()),
]);
$this->api = new AutomaticEmails(new AutomaticEmailsController($this->wp, $automaticEmailFactory), $this->wp);
}
public function testItRequiresProperlyFormattedRequestWhenGettingEventOptions() {