Skip to content

Commit

Permalink
Merge pull request #83 from synolia/fix/execute-immediately
Browse files Browse the repository at this point in the history
fix execute immediately
  • Loading branch information
oallain committed May 30, 2023
2 parents a3049b3 + 72f556b commit ea44054
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ endif
update-dependencies:
${COMPOSER} config extra.symfony.require "~${SYMFONY_VERSION}"
${COMPOSER} require symfony/asset:~${SYMFONY_VERSION} --no-scripts --no-update
ifeq ($(shell [[ $(SYLIUS_VERSION) == 1.10.0 ]] && echo true ),true)
${COMPOSER} require php-http/message-factory --no-scripts --no-update
endif
${COMPOSER} update --no-progress -n

install-plugin:
Expand Down Expand Up @@ -80,7 +83,7 @@ phpunit-configure:
cp phpunit.xml.dist ${TEST_DIRECTORY}/phpunit.xml

phpunit-run:
cd ${TEST_DIRECTORY} && ./vendor/bin/phpunit
cd ${TEST_DIRECTORY} && ./vendor/bin/phpunit --testdox

behat-configure: ## Configure Behat
(cd ${TEST_DIRECTORY} && cp behat.yml.dist behat.yml)
Expand Down
2 changes: 2 additions & 0 deletions src/Command/SynoliaSchedulerRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// delayed execution just after, to keep cron comparison effective
if ($this->shouldExecuteCommand($command, $io)) {
$this->scheduledCommandPlanner->plan($command);
// The execution is planned, and does not need to be launched again in the future.
$command->setExecuteImmediately(false);
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/PHPUnit/Command/SynoliaSchedulerRunCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public function testExecuteWithANewCommandThatItMarkedAsExecuteNow(): void
self::assertStringContainsString('Immediately execution asked for : about', $commandTester->getDisplay());
self::assertStringContainsString('Execute Command "about" - last execution : never', $commandTester->getDisplay());
self::assertStringNotContainsString('Nothing to do', $commandTester->getDisplay());
self::assertFalse($scheduledCommand->isExecuteImmediately());
}

public function testExecuteNonExistentCommand(): void
Expand Down

0 comments on commit ea44054

Please sign in to comment.