Files
piratepoet/packages/php/email-editor/tests/integration/Engine/EmailEditorTest.php
Jan Lysý 8dc9c28fdf Fix namespace in integration tests
This commit also removed the redundant directory EmailEditor from integration tests directory.
[MAILPOET-6216]
2024-09-23 15:16:59 +02:00

37 lines
988 B
PHP

<?php declare(strict_types = 1);
namespace MailPoet\EmailEditor\Engine;
class EmailEditorTest extends \MailPoetTest {
/** @var EmailEditor */
private $emailEditor;
/** @var callable */
private $postRegisterCallback;
public function _before() {
parent::_before();
$this->emailEditor = $this->diContainer->get(EmailEditor::class);
$this->postRegisterCallback = function ($postTypes) {
$postTypes[] = [
'name' => 'custom_email_type',
'args' => [],
'meta' => [],
];
return $postTypes;
};
add_filter('mailpoet_email_editor_post_types', $this->postRegisterCallback);
$this->emailEditor->initialize();
}
public function testItRegistersCustomPostTypeAddedViaHook() {
$postTypes = get_post_types();
$this->assertArrayHasKey('custom_email_type', $postTypes);
}
public function _after() {
parent::_after();
remove_filter('mailpoet_email_editor_post_types', $this->postRegisterCallback);
}
}