From dce4c0bd48eb805b1ae570ca7dd779a92e42f741 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Tue, 16 Jul 2024 13:16:57 +0200 Subject: [PATCH] Add missing prophecy trait --- tests/Functional/BaseDatabaseTestCase.php | 2 +- tests/Functional/Command/ScheduleSystemTasksCommandTest.php | 2 +- tests/Functional/Entity/TaskRepositoryTest.php | 6 +++--- tests/Unit/Builder/TaskBuilderFactoryTest.php | 3 +++ tests/Unit/Builder/TaskBuilderTest.php | 3 +++ tests/Unit/Command/ScheduleSystemTasksCommandTest.php | 3 +++ tests/Unit/DependencyInjection/HandlerCompilerPassTest.php | 3 +++ tests/Unit/EventListener/RunListenerTest.php | 3 +++ tests/Unit/EventListener/TaskExecutionListenerTest.php | 3 +++ tests/Unit/Executor/SeparateProcessExecutorTest.php | 3 +++ 10 files changed, 26 insertions(+), 5 deletions(-) diff --git a/tests/Functional/BaseDatabaseTestCase.php b/tests/Functional/BaseDatabaseTestCase.php index 92cffd3..4380eb6 100644 --- a/tests/Functional/BaseDatabaseTestCase.php +++ b/tests/Functional/BaseDatabaseTestCase.php @@ -22,7 +22,7 @@ abstract class BaseDatabaseTestCase extends KernelTestCase /** * {@inheritdoc} */ - public function setUp() + protected function setUp(): void { self::bootKernel(); diff --git a/tests/Functional/Command/ScheduleSystemTasksCommandTest.php b/tests/Functional/Command/ScheduleSystemTasksCommandTest.php index a269b92..1cf217a 100644 --- a/tests/Functional/Command/ScheduleSystemTasksCommandTest.php +++ b/tests/Functional/Command/ScheduleSystemTasksCommandTest.php @@ -11,7 +11,7 @@ protected function setUp(): void { self::bootKernel(); if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) { - return $this->markTestSkipped('This testcase will only be called for doctrine storage.'); + $this->markTestSkipped('This testcase will only be called for doctrine storage.'); } parent::setUp(); diff --git a/tests/Functional/Entity/TaskRepositoryTest.php b/tests/Functional/Entity/TaskRepositoryTest.php index a23e25e..a8e2e59 100644 --- a/tests/Functional/Entity/TaskRepositoryTest.php +++ b/tests/Functional/Entity/TaskRepositoryTest.php @@ -22,7 +22,7 @@ protected function setUp(): void public function testFindBySystemKey() { if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) { - return $this->markTestSkipped('This testcase will only be called for doctrine storage.'); + $this->markTestSkipped('This testcase will only be called for doctrine storage.'); } $task = $this->createTask(); @@ -37,7 +37,7 @@ public function testFindBySystemKey() public function testFindBySystemKeyNotFound() { if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) { - return $this->markTestSkipped('This testcase will only be called for doctrine storage.'); + $this->markTestSkipped('This testcase will only be called for doctrine storage.'); } $task = $this->createTask(); @@ -49,7 +49,7 @@ public function testFindBySystemKeyNotFound() public function testFindSystemTasks() { if ('doctrine' !== self::$kernel->getContainer()->getParameter('kernel.storage')) { - return $this->markTestSkipped('This testcase will only be called for doctrine storage.'); + $this->markTestSkipped('This testcase will only be called for doctrine storage.'); } $task1 = $this->createTask(); diff --git a/tests/Unit/Builder/TaskBuilderFactoryTest.php b/tests/Unit/Builder/TaskBuilderFactoryTest.php index 7e96346..1c57621 100644 --- a/tests/Unit/Builder/TaskBuilderFactoryTest.php +++ b/tests/Unit/Builder/TaskBuilderFactoryTest.php @@ -3,6 +3,7 @@ namespace Unit\Builder; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Task\Scheduler\TaskSchedulerInterface; use Task\TaskBundle\Builder\TaskBuilder; use Task\TaskBundle\Builder\TaskBuilderFactory; @@ -10,6 +11,8 @@ class TaskBuilderFactoryTest extends TestCase { + use ProphecyTrait; + public function testCreate() { $task = $this->prophesize(TaskInterface::class); diff --git a/tests/Unit/Builder/TaskBuilderTest.php b/tests/Unit/Builder/TaskBuilderTest.php index 64e421b..019ff47 100644 --- a/tests/Unit/Builder/TaskBuilderTest.php +++ b/tests/Unit/Builder/TaskBuilderTest.php @@ -3,6 +3,7 @@ namespace Task\TaskBundle\Unit\Builder; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Task\Scheduler\TaskSchedulerInterface; use Task\TaskBundle\Builder\NotSupportedMethodException; use Task\TaskBundle\Builder\TaskBuilder; @@ -11,6 +12,8 @@ class TaskBuilderTest extends TestCase { + use ProphecyTrait; + public function testSetSystemKey() { $task = $this->prophesize(Task::class); diff --git a/tests/Unit/Command/ScheduleSystemTasksCommandTest.php b/tests/Unit/Command/ScheduleSystemTasksCommandTest.php index 51acda8..c8eb9b0 100644 --- a/tests/Unit/Command/ScheduleSystemTasksCommandTest.php +++ b/tests/Unit/Command/ScheduleSystemTasksCommandTest.php @@ -5,6 +5,7 @@ use Cron\CronExpression; use PHPUnit\Framework\TestCase; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\OutputInterface; use Task\Execution\TaskExecutionInterface; @@ -19,6 +20,8 @@ class ScheduleSystemTasksCommandTest extends TestCase { + use ProphecyTrait; + /** * @var TaskSchedulerInterface */ diff --git a/tests/Unit/DependencyInjection/HandlerCompilerPassTest.php b/tests/Unit/DependencyInjection/HandlerCompilerPassTest.php index d4c2677..df5587f 100644 --- a/tests/Unit/DependencyInjection/HandlerCompilerPassTest.php +++ b/tests/Unit/DependencyInjection/HandlerCompilerPassTest.php @@ -12,6 +12,7 @@ namespace Task\TaskBundle\Unit\DependencyInjection; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; @@ -22,6 +23,8 @@ */ class HandlerCompilerPassTest extends TestCase { + use ProphecyTrait; + public function testProcess() { $container = $this->prophesize(ContainerBuilder::class); diff --git a/tests/Unit/EventListener/RunListenerTest.php b/tests/Unit/EventListener/RunListenerTest.php index 68b23d1..e5157aa 100644 --- a/tests/Unit/EventListener/RunListenerTest.php +++ b/tests/Unit/EventListener/RunListenerTest.php @@ -12,6 +12,7 @@ namespace Task\TaskBundle\Tests\Unit\EventListener; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\EventDispatcher\Event as LegacyEvent; use Symfony\Contracts\EventDispatcher\Event; use Task\Runner\TaskRunnerInterface; @@ -22,6 +23,8 @@ */ class RunListenerTest extends TestCase { + use ProphecyTrait; + public function testRun() { if (\class_exists(LegacyEvent::class)) { diff --git a/tests/Unit/EventListener/TaskExecutionListenerTest.php b/tests/Unit/EventListener/TaskExecutionListenerTest.php index 3f371e8..d542af3 100644 --- a/tests/Unit/EventListener/TaskExecutionListenerTest.php +++ b/tests/Unit/EventListener/TaskExecutionListenerTest.php @@ -13,6 +13,7 @@ use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Task\Event\TaskExecutionEvent; use Task\TaskBundle\EventListener\DoctrineTaskExecutionListener; @@ -21,6 +22,8 @@ */ class TaskExecutionListenerTest extends TestCase { + use ProphecyTrait; + public function testClearEntityManagerAfterTask() { $entityManager = $this->prophesize(EntityManagerInterface::class); diff --git a/tests/Unit/Executor/SeparateProcessExecutorTest.php b/tests/Unit/Executor/SeparateProcessExecutorTest.php index 0ea90a7..7072ed9 100644 --- a/tests/Unit/Executor/SeparateProcessExecutorTest.php +++ b/tests/Unit/Executor/SeparateProcessExecutorTest.php @@ -12,6 +12,7 @@ namespace Task\TaskBundle\Tests\Unit\Executor; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\Process\Process; use Task\Execution\TaskExecutionInterface; use Task\Executor\FailedException; @@ -25,6 +26,8 @@ class SeparateProcessExecutorTest extends TestCase { + use ProphecyTrait; + /** * @var TaskHandlerFactoryInterface */