Fix integration tests compatibility
[MAILPOET-4001]
This commit is contained in:
@@ -25,6 +25,7 @@ require_once('APITestNamespacedEndpointStubV1.php');
|
||||
require_once('APITestNamespacedEndpointStubV2.php');
|
||||
|
||||
class APITest extends \MailPoetTest {
|
||||
/** @var JSONAPI */
|
||||
public $api;
|
||||
public $wpUserId;
|
||||
/** @var Container */
|
||||
@@ -54,7 +55,7 @@ class APITest extends \MailPoetTest {
|
||||
$this->container->compile();
|
||||
$this->errorHandler = $this->container->get(ErrorHandler::class);
|
||||
$this->settings = $this->container->get(SettingsController::class);
|
||||
$this->api = new \MailPoet\API\JSON\API(
|
||||
$this->api = new JSONAPI(
|
||||
$this->container,
|
||||
$this->container->get(AccessControl::class),
|
||||
$this->errorHandler,
|
||||
|
@@ -61,7 +61,7 @@ class APITest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
private function getApi($subscriberActions = null) {
|
||||
private function getApi($subscriberActions = null): API {
|
||||
if (!$subscriberActions) {
|
||||
$subscriberActions = $this->getSubscribers();
|
||||
}
|
||||
|
@@ -9,7 +9,9 @@ use MailPoet\Config\Installer;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class InstallerTest extends \MailPoetTest {
|
||||
/** @var Installer */
|
||||
public $installer;
|
||||
/** @var string */
|
||||
public $slug;
|
||||
|
||||
public function _before() {
|
||||
|
@@ -9,6 +9,7 @@ use MailPoet\Config\Renderer;
|
||||
use MailPoetVendor\Twig\Environment as TwigEnvironment;
|
||||
|
||||
class RendererTest extends \MailPoetTest {
|
||||
/** @var Renderer */
|
||||
public $renderer;
|
||||
|
||||
public function _before() {
|
||||
|
@@ -7,9 +7,13 @@ use Codeception\Stub\Expected;
|
||||
use MailPoet\Config\Updater;
|
||||
|
||||
class UpdaterTest extends \MailPoetTest {
|
||||
/** @var Updater */
|
||||
public $updater;
|
||||
/** @var string */
|
||||
public $version;
|
||||
/** @var string */
|
||||
public $slug;
|
||||
/** @var string */
|
||||
public $pluginName;
|
||||
|
||||
public function _before() {
|
||||
|
@@ -15,6 +15,7 @@ use MailPoetVendor\Carbon\Carbon;
|
||||
require_once('KeyCheckWorkerMockImplementation.php');
|
||||
|
||||
class KeyCheckWorkerTest extends \MailPoetTest {
|
||||
/** @var MockKeyCheckWorker */
|
||||
public $worker;
|
||||
|
||||
/** @var ScheduledTaskFactory */
|
||||
|
@@ -1042,7 +1042,7 @@ class SendingQueueTest extends \MailPoetTest {
|
||||
return $queue;
|
||||
}
|
||||
|
||||
private function getSendingQueueWorker($newsletterRepositoryMock = null, $mailerMock = null) {
|
||||
private function getSendingQueueWorker($newsletterRepositoryMock = null, $mailerMock = null): SendingQueueWorker {
|
||||
return new SendingQueueWorker(
|
||||
$this->sendingErrorHandler,
|
||||
$this->sendingThrottlingHandler,
|
||||
|
@@ -177,8 +177,8 @@ class AutomatedEmailsTest extends \MailPoetTest {
|
||||
->method('render')
|
||||
->with(
|
||||
$this->anything(),
|
||||
$this->callback(function($context){
|
||||
return strpos($context['linkSettings'], 'mailpoet-settings');
|
||||
$this->callback(function($context): bool {
|
||||
return (bool)strpos($context['linkSettings'], 'mailpoet-settings');
|
||||
}));
|
||||
|
||||
$this->cronWorkerRunner->run($this->statsNotifications);
|
||||
|
@@ -12,6 +12,7 @@ class AmazonSESTest extends \MailPoetTest {
|
||||
public $extraParams;
|
||||
public $newsletter;
|
||||
public $subscriber;
|
||||
/** @var AmazonSES */
|
||||
public $mailer;
|
||||
public $returnPath;
|
||||
public $replyTo;
|
||||
|
@@ -16,6 +16,7 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
public $metaInfo;
|
||||
public $newsletter;
|
||||
public $subscriber;
|
||||
/** @var MailPoet */
|
||||
public $mailer;
|
||||
public $replyTo;
|
||||
public $sender;
|
||||
@@ -159,7 +160,6 @@ class MailPoetAPITest extends \MailPoetTest {
|
||||
|
||||
public function testItWillNotSendIfApiKeyIsMarkedInvalid() {
|
||||
if (getenv('WP_TEST_MAILER_ENABLE_SENDING') !== 'true') $this->markTestSkipped();
|
||||
$this->mailer->apiKey = 'someapi';
|
||||
$this->mailer->servicesChecker = Stub::make(
|
||||
new ServicesChecker(),
|
||||
['isMailPoetAPIKeyValid' => false],
|
||||
|
@@ -12,6 +12,7 @@ class PHPMailTest extends \MailPoetTest {
|
||||
public $extraParams;
|
||||
public $newsletter;
|
||||
public $subscriber;
|
||||
/** @var PHPMail */
|
||||
public $mailer;
|
||||
public $returnPath;
|
||||
public $replyTo;
|
||||
|
@@ -13,6 +13,7 @@ class SMTPTest extends \MailPoetTest {
|
||||
public $extraParams;
|
||||
public $newsletter;
|
||||
public $subscriber;
|
||||
/** @var SMTP */
|
||||
public $mailer;
|
||||
public $returnPath;
|
||||
public $replyTo;
|
||||
|
@@ -12,6 +12,7 @@ class SendGridTest extends \MailPoetTest {
|
||||
public $extraParams;
|
||||
public $newsletter;
|
||||
public $subscriber;
|
||||
/** @var SendGrid */
|
||||
public $mailer;
|
||||
public $replyTo;
|
||||
public $sender;
|
||||
|
@@ -214,7 +214,7 @@ class BridgeTest extends \MailPoetTest {
|
||||
$response = ['state' => Bridge::KEY_VALID];
|
||||
/** @var Bridge&MockObject $bridge */
|
||||
$bridge = Stub::makeEmptyExcept(
|
||||
$this->bridge,
|
||||
Bridge::class,
|
||||
'onSettingsSave',
|
||||
[
|
||||
'checkMSSKey' => $response,
|
||||
|
@@ -177,7 +177,7 @@ abstract class MailPoetTest extends \Codeception\TestCase\Test { // phpcs:ignore
|
||||
/** @var EntityManager */
|
||||
protected $entityManager;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->diContainer = ContainerWrapper::getInstance(WP_DEBUG);
|
||||
$this->connection = $this->diContainer->get(Connection::class);
|
||||
$this->entityManager = $this->diContainer->get(EntityManager::class);
|
||||
@@ -189,7 +189,7 @@ abstract class MailPoetTest extends \Codeception\TestCase\Test { // phpcs:ignore
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
$this->entityManager->clear();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
Reference in New Issue
Block a user