Skip to content

Commit

Permalink
Fixed handling scheduler action
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Jul 15, 2020
1 parent 2ebe7ae commit 4164f7a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Classes/Scheduler/Provider/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )
$additionalFields = array();

// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldController] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldController] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldController] = $task->{$this->fieldController};
}

Expand All @@ -67,7 +67,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldSite] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldSite] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldSite] = $task->{$this->fieldSite};
}

Expand All @@ -86,7 +86,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldTSconfig] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldTSconfig] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldTSconfig] = $task->{$this->fieldTSconfig};
}

Expand Down
16 changes: 8 additions & 8 deletions Classes/Scheduler/Provider/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldSenderFrom] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldSenderFrom] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldSenderFrom] = $task->{$this->fieldSenderFrom};
}

Expand All @@ -71,7 +71,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldSenderEmail] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldSenderEmail] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldSenderEmail] = $task->{$this->fieldSenderEmail};
}

Expand All @@ -89,7 +89,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldReplyEmail] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldReplyEmail] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldReplyEmail] = $task->{$this->fieldReplyEmail};
}

Expand All @@ -107,7 +107,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldPageCatalog] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldPageCatalog] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldPageCatalog] = $task->{$this->fieldPageCatalog};
}

Expand All @@ -125,7 +125,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldPageDetail] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldPageDetail] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldPageDetail] = $task->{$this->fieldPageDetail};
}

Expand All @@ -143,7 +143,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldPageDownload] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldPageDownload] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldPageDownload] = $task->{$this->fieldPageDownload};
}

Expand All @@ -161,7 +161,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldPageLogin] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldPageLogin] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldPageLogin] = $task->{$this->fieldPageLogin};
}

Expand All @@ -179,7 +179,7 @@ protected function getFields( array &$taskInfo, $task, $parentObject )


// In case of editing a task, set to the internal value if data wasn't already submitted
if( empty( $taskInfo[$this->fieldTemplateBaseurl] ) && $parentObject->getCurrentAction() === Action::EDIT ) {
if( empty( $taskInfo[$this->fieldTemplateBaseurl] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
$taskInfo[$this->fieldTemplateBaseurl] = $task->{$this->fieldTemplateBaseurl};
}

Expand Down
7 changes: 3 additions & 4 deletions Tests/Unit/Scheduler/Provider/Email6Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@


use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController;
use TYPO3\CMS\Scheduler\Task\Enumeration\Action;
use Aimeos\Aimeos\Scheduler;


class Email6Test
extends \TYPO3\CMS\Core\Tests\UnitTestCase
class Email6Test extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
private $object;

Expand All @@ -33,7 +33,6 @@ public function getAdditionalFields()
{
$taskInfo = array();
$module = new SchedulerModuleController();
$module->CMD = 'edit';

$result = $this->object->getAdditionalFields( $taskInfo, $this->object, $module );

Expand All @@ -54,7 +53,7 @@ public function getAdditionalFieldsException()
{
$taskInfo = array();
$module = new SchedulerModuleController();
$module->CMD = 'edit';
$module->setCurrentAction( new Action( 'EDIT' ) );

$mock = $this->getMockBuilder( '\Aimeos\Aimeos\Scheduler\Provider\Email6' )
->setMethods( array( 'getFields' ) )->getMock();
Expand Down
8 changes: 4 additions & 4 deletions Tests/Unit/Scheduler/Provider/Typo6Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@


use TYPO3\CMS\Scheduler\Controller\SchedulerModuleController;
use TYPO3\CMS\Scheduler\Task\Enumeration\Action;


class Typo6Test
extends \TYPO3\CMS\Core\Tests\UnitTestCase
class Typo6Test extends \TYPO3\CMS\Core\Tests\UnitTestCase
{
private $object;

Expand All @@ -32,7 +32,7 @@ public function getAdditionalFields()
{
$taskInfo = array();
$module = new SchedulerModuleController();
$module->CMD = 'edit';
$module->setCurrentAction( new Action( 'EDIT' ) );

$result = $this->object->getAdditionalFields( $taskInfo, $this->object, $module );

Expand All @@ -50,7 +50,7 @@ public function getAdditionalFieldsException()
{
$taskInfo = array();
$module = new SchedulerModuleController();
$module->CMD = 'edit';
$module->setCurrentAction( new Action( 'EDIT' ) );

$mock = $this->getMockBuilder( '\Aimeos\Aimeos\Scheduler\Provider\Typo6' )
->setMethods( array( 'getFields' ) )->getMock();
Expand Down

0 comments on commit 4164f7a

Please sign in to comment.