Move TestAction to Stubs
[MAILPOET-4935]
This commit is contained in:
@@ -7,20 +7,16 @@ use MailPoet\Automation\Engine\Data\Automation;
|
||||
use MailPoet\Automation\Engine\Data\AutomationRun;
|
||||
use MailPoet\Automation\Engine\Data\AutomationRunLog;
|
||||
use MailPoet\Automation\Engine\Data\Step;
|
||||
use MailPoet\Automation\Engine\Data\StepRunArgs;
|
||||
use MailPoet\Automation\Engine\Data\StepValidationArgs;
|
||||
use MailPoet\Automation\Engine\Hooks;
|
||||
use MailPoet\Automation\Engine\Integration\Action;
|
||||
use MailPoet\Automation\Engine\Registry;
|
||||
use MailPoet\Automation\Engine\Storage\AutomationRunLogStorage;
|
||||
use MailPoet\Automation\Engine\Storage\AutomationRunStorage;
|
||||
use MailPoet\Automation\Engine\Storage\AutomationStorage;
|
||||
use MailPoet\Util\Security;
|
||||
use MailPoet\Validator\Builder;
|
||||
use MailPoet\Validator\Schema\ObjectSchema;
|
||||
use MailPoet\Test\Automation\Stubs\TestAction;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
use stdClass;
|
||||
|
||||
require_once __DIR__ . '/../../Stubs/TestAction.php';
|
||||
//phpcs:disable Squiz.Classes.ClassFileName.NoMatch, Generic.Files.OneClassPerFile.MultipleFound, PSR1.Classes.ClassDeclaration.MultipleClasses
|
||||
|
||||
class AutomationRunLogTest extends \MailPoetTest {
|
||||
@@ -271,42 +267,3 @@ class AutomationRunLogTest extends \MailPoetTest {
|
||||
return $action;
|
||||
}
|
||||
}
|
||||
|
||||
class TestAction implements Action {
|
||||
|
||||
private $callback;
|
||||
private $key;
|
||||
|
||||
public function __construct() {
|
||||
$this->key = Security::generateRandomString(10);
|
||||
}
|
||||
|
||||
public function setCallback($callback) {
|
||||
$this->callback = $callback;
|
||||
}
|
||||
|
||||
public function getSubjectKeys(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
public function validate(StepValidationArgs $args): void {
|
||||
}
|
||||
|
||||
public function run(StepRunArgs $args): void {
|
||||
if ($this->callback) {
|
||||
($this->callback)($args);
|
||||
}
|
||||
}
|
||||
|
||||
public function getKey(): string {
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return 'Test Action';
|
||||
}
|
||||
|
||||
public function getArgsSchema(): ObjectSchema {
|
||||
return Builder::object();
|
||||
}
|
||||
}
|
||||
|
54
mailpoet/tests/integration/Automation/Stubs/TestAction.php
Normal file
54
mailpoet/tests/integration/Automation/Stubs/TestAction.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace MailPoet\Test\Automation\Stubs;
|
||||
|
||||
use MailPoet\Automation\Engine\Data\StepRunArgs;
|
||||
use MailPoet\Automation\Engine\Data\StepValidationArgs;
|
||||
use MailPoet\Automation\Engine\Integration\Action;
|
||||
use MailPoet\Util\Security;
|
||||
use MailPoet\Validator\Builder;
|
||||
use MailPoet\Validator\Schema\ObjectSchema;
|
||||
|
||||
class TestAction implements Action {
|
||||
|
||||
private $subjectKeys = [];
|
||||
private $callback;
|
||||
private $key;
|
||||
|
||||
public function __construct() {
|
||||
$this->key = Security::generateRandomString(10);
|
||||
}
|
||||
|
||||
public function setCallback($callback) {
|
||||
$this->callback = $callback;
|
||||
}
|
||||
|
||||
public function getSubjectKeys(): array {
|
||||
return $this->subjectKeys;
|
||||
}
|
||||
|
||||
public function setSubjectKeys(string ...$subjectKeys): void {
|
||||
$this->subjectKeys = $subjectKeys;
|
||||
}
|
||||
|
||||
public function validate(StepValidationArgs $args): void {
|
||||
}
|
||||
|
||||
public function run(StepRunArgs $args): void {
|
||||
if ($this->callback) {
|
||||
($this->callback)($args);
|
||||
}
|
||||
}
|
||||
|
||||
public function getKey(): string {
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return 'Test Action';
|
||||
}
|
||||
|
||||
public function getArgsSchema(): ObjectSchema {
|
||||
return Builder::object();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user