Your project must not contain invalid function or method calls

More information: https://insight.symfony.com/what-we-analyse/php.invalid_call

  1. protected function handleOperationViaFiber(Closure $func): mixed
  2. {
  3. $fiber = new Fiber(callback: function (Closure $operation): void {
  4. $value = $operation();
  5. Fiber::suspend(value: $value);

    Call to static method suspend() on an unknown class Fiber.

    Time to fix: about 9 minutes
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. });
  7. try {
  8. $return = $fiber->start($func);
  9. } catch (Throwable $throwable) {

Your project must not contain invalid instantiations

More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation

  1. $this->logger = $logger ?? new NullLogger();
  2. }
  3. protected function handleOperationViaFiber(Closure $func): mixed
  4. {
  5. $fiber = new Fiber(callback: function (Closure $operation): void {

    Instantiated class Fiber not found.

    Time to fix: about 1 hour
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $value = $operation();
  7. Fiber::suspend(value: $value);
  8. });

Your project files should use safer permissions

More information: https://insight.symfony.com/what-we-analyse/php.too_permissive_file_permissions

Your project contains files with permissive permissions. In order to avoid opening a security breach, you should restrict execution rights on following files:

  • src/EventListener/StopWorkerOnNextTaskSubscriber.php

Time to fix: about 15 minutes
Read doc Open Issue Permalink
Collective
chmod a-x 'src/EventListener/StopWorkerOnNextTaskSubscriber.php'

Your project should not contain duplicated code 151

More information: https://insight.symfony.com/what-we-analyse/php.duplicated_code

  1. return $serializer;
  2. }
  3. abstract protected function buildConnection(): Connection;
  4. public function testConnectionCanListEmptyTasks(): void

    The next 21 lines appear both in tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:87 and tests/Bridge/Doctrine/Transport/ConnectionIntegrationTest.php:104.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  5. {
  6. $list = $this->connection->list();
  7. self::assertCount(0, $list);
  8. }
  1. public function testConnectionCanRetrieveASingleTask(): void
  2. {
  3. $this->connection->setup();
  4. $this->connection->create(task: new NullTask(name: 'foo'));
  5. $task = $this->connection->get(taskName: 'foo');

    The next 27 lines appear both in tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:165 and tests/Bridge/Doctrine/Transport/ConnectionIntegrationTest.php:182.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertInstanceOf(NullTask::class, $task);
  7. self::assertSame('foo', $task->getName());
  8. self::assertSame('* * * * *', $task->getExpression());
  9. }
  1. public function testMessengerTaskCanBeCreated(): void
  2. {
  3. $this->connection->setup();
  4. $this->connection->create(task: new MessengerTask(name: 'foo', message: new MessengerMessage()));
  5. $task = $this->connection->get(taskName: 'foo');

    The next 110 lines appear both in tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:223 and tests/Bridge/Doctrine/Transport/ConnectionIntegrationTest.php:240.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertInstanceOf(MessengerTask::class, $task);
  7. self::assertInstanceOf(MessengerMessage::class, $task->getMessage());
  8. self::assertSame('foo', $task->getName());
  9. self::assertSame('* * * * *', $task->getExpression());
  1. }
  2. /**
  3. * @throws Exception {@see Connection::setup()}
  4. */
  5. public function testTaskCanBePaused(): void

    The next 19 lines appear both in tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:279 and tests/Bridge/Doctrine/Transport/ConnectionIntegrationTest.php:369.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $this->connection->setup();
  8. $this->connection->create(new NullTask('foo'));
  9. $task = $this->connection->get('foo');
  1. }
  2. /**
  3. * @throws Exception {@see Connection::setup()}
  4. */
  5. public function testTaskCanBePaused(): void

    The next 17 lines appear both in tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:279 and tests/Bridge/Doctrine/Transport/ConnectionIntegrationTest.php:340.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $this->connection->setup();
  8. $this->connection->create(new NullTask('foo'));
  9. $task = $this->connection->get('foo');
  1. }
  2. /**
  3. * @throws Exception {@see Connection::setup()}
  4. */
  5. public function testTaskCanBeEnabled(): void

    The next 20 lines appear both in tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:323 and tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:353.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $this->connection->setup();
  8. $this->connection->create(new NullTask('foo'));
  9. $task = $this->connection->get('foo');
  1. self::assertInstanceOf(NullTask::class, $task);
  2. self::assertSame('foo', $task->getName());
  3. self::assertSame('* * * * *', $task->getExpression());
  4. self::assertSame(TaskInterface::ENABLED, $task->getState());
  5. $this->connection->pause('foo');

    The next 28 lines appear both in tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:335 and tests/Bridge/Doctrine/Transport/ConnectionIntegrationTest.php:351.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. $task = $this->connection->get('foo');
  7. self::assertInstanceOf(NullTask::class, $task);
  8. self::assertSame(TaskInterface::PAUSED, $task->getState());
  1. self::assertInstanceOf(NullTask::class, $task);
  2. self::assertSame('foo', $task->getName());
  3. self::assertSame('* * * * *', $task->getExpression());
  4. self::assertSame(TaskInterface::ENABLED, $task->getState());
  5. $this->connection->pause('foo');

    The next 53 lines appear both in tests/Bridge/Doctrine/Transport/AbstractConnectionIntegrationTest.php:365 and tests/Bridge/Doctrine/Transport/ConnectionIntegrationTest.php:380.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. $task = $this->connection->get('foo');
  7. self::assertInstanceOf(NullTask::class, $task);
  8. self::assertSame(TaskInterface::PAUSED, $task->getState());
  1. /**
  2. * @author Guillaume Loulier <contact@guillaumeloulier.fr>
  3. */
  4. final class ConnectionTest extends TestCase
  5. {
  6. public function testConnectionCanReturnATaskList(): void

    The next 19 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:42 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:91.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  7. {
  8. $serializer = $this->createMock(SerializerInterface::class);
  9. $queryBuilder = $this->getQueryBuilderMock();
  10. $queryBuilder->expects(self::exactly(2))->method('select')
  1. ;
  2. $queryBuilder->expects(self::once())->method('getSQL')->willReturn('SELECT * FROM _symfony_scheduler_tasks');
  3. $queryBuilder->expects(self::once())->method('getParameters')->willReturn([]);
  4. $queryBuilder->expects(self::once())->method('getParameterTypes')->willReturn([]);
  5. $statement = $this->createMock(class_exists(NextResult::class) ? NextResult::class : Result::class);

    The next 20 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:108 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:165.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $statement->expects(self::once())->method('fetchOne')->willReturn('0');
  7. $driverConnection = $this->getDBALConnectionMock();
  8. $driverConnection->expects(self::once())->method('createQueryBuilder')->willReturn($queryBuilder);
  9. $driverConnection->expects(self::once())->method('executeQuery')->willReturn($statement);
  1. ]));
  2. self::assertEmpty($connection->list());
  3. }
  4. public function testConnectionCannotReturnAnInvalidTask(): void

    The next 17 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:130 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:190.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  5. {
  6. $serializer = $this->createMock(SerializerInterface::class);
  7. $expressionBuilder = $this->createMock(ExpressionBuilder::class);
  8. $expressionBuilder->expects(self::once())->method('eq')
  1. public function testConnectionCannotReturnAnInvalidTask(): void
  2. {
  3. $serializer = $this->createMock(SerializerInterface::class);
  4. $expressionBuilder = $this->createMock(ExpressionBuilder::class);

    The next 14 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:134 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:497.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $expressionBuilder->expects(self::once())->method('eq')
  6. ->with(self::equalTo('t.task_name'), self::equalTo(':name'))
  7. ->willReturn('t.task_name = :name')
  8. ;
  1. public function testConnectionCannotReturnAnInvalidTask(): void
  2. {
  3. $serializer = $this->createMock(SerializerInterface::class);
  4. $expressionBuilder = $this->createMock(ExpressionBuilder::class);

    The next 20 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:134 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:321.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $expressionBuilder->expects(self::once())->method('eq')
  6. ->with(self::equalTo('t.task_name'), self::equalTo(':name'))
  7. ->willReturn('t.task_name = :name')
  8. ;
  1. $queryBuilder->expects(self::once())->method('setParameter')->with(
  2. self::equalTo('name'),
  3. self::equalTo('foo'),
  4. self::equalTo(ParameterType::STRING)
  5. );
  6. $queryBuilder->expects(self::once())->method('getSQL')

    The next 15 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:155 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:563.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. ->willReturn('SELECT * FROM _symfony_scheduler_tasks WHERE task_name = :name')
  8. ;
  9. $queryBuilder->expects(self::once())->method('getParameters')
  10. ->willReturn(['name' => 'foo'])
  11. ;
  1. self::equalTo(ParameterType::STRING)
  2. );
  3. $queryBuilder->expects(self::once())->method('getSQL')
  4. ->willReturn('SELECT * FROM _symfony_scheduler_tasks WHERE task_name = :name')
  5. ;
  6. $queryBuilder->expects(self::once())->method('getParameters')

    The next 14 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:158 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:345.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. ->willReturn(['name' => 'foo'])
  8. ;
  9. $queryBuilder->expects(self::once())->method('getParameterTypes')
  10. ->willReturn(['name' => ParameterType::STRING])
  11. ;
  1. ->with(self::equalTo('t.task_name'), self::equalTo(':name'))
  2. ->willReturn('t.task_name = :name')
  3. ;
  4. $queryBuilder = $this->getQueryBuilderMock();
  5. $queryBuilder->expects(self::once())->method('expr')->willReturn($expressionBuilder);

    The next 34 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:201 and tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:239.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $queryBuilder->expects(self::exactly(2))->method('select')
  7. ->withConsecutive([self::equalTo('t.*')], [self::equalTo('COUNT(DISTINCT t.id)')])
  8. ->willReturnSelf()
  9. ;
  10. $queryBuilder->expects(self::once())->method('from')
  1. ->willReturn('t.task_name = :name')
  2. ;
  3. $queryBuilder = $this->getQueryBuilderMock();
  4. $queryBuilder->expects(self::once())->method('expr')->willReturn($expressionBuilder);
  5. $queryBuilder->expects(self::exactly(2))->method('select')

    The next 18 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:202 and tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:382.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. ->withConsecutive([self::equalTo('t.*')], [self::equalTo('COUNT(DISTINCT t.id)')])
  7. ->willReturnSelf()
  8. ;
  9. $queryBuilder->expects(self::once())->method('from')
  10. ->with(self::equalTo('_symfony_scheduler_tasks'), self::equalTo('t'))
  1. $queryBuilder->expects(self::once())->method('setParameter')->with(
  2. self::equalTo('name'),
  3. self::equalTo('foo'),
  4. self::equalTo(ParameterType::STRING)
  5. )->willReturnSelf();
  6. $queryBuilder->expects(self::once())->method('getSQL')

    The next 16 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:219 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:515.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. ->willReturn('SELECT * FROM _symfony_scheduler_tasks WHERE task_name = :name')
  8. ;
  9. $queryBuilder->expects(self::once())->method('getParameters')
  10. ->willReturn(['name' => 'foo'])
  11. ;
  1. public function testConnectionCannotInsertASingleTaskWithDuplicatedIdentifier(): void
  2. {
  3. $serializer = $this->createMock(SerializerInterface::class);
  4. $task = new NullTask('foo');

    The next 40 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:319 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:384.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Jérémy
  5. $expressionBuilder = $this->createMock(ExpressionBuilder::class);
  6. $expressionBuilder->expects(self::once())->method('eq')
  7. ->with(self::equalTo('t.task_name'), self::equalTo(':name'))
  8. ->willReturn('t.task_name = :name')
  1. new FirstInFirstOutPolicy(),
  2. ]));
  3. $connection->create($task);
  4. }
  5. public function testConnectionCannotPauseATaskWithInvalidIdentifier(): void

    The next 17 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:437 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:545.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $serializer = $this->createMock(SerializerInterface::class);
  8. $expressionBuilder = $this->createMock(ExpressionBuilder::class);
  9. $expressionBuilder->expects(self::once())->method('eq')
  1. ->willReturn('SELECT * FROM _symfony_scheduler_tasks WHERE task_name = :name')
  2. ;
  3. $queryBuilder->expects(self::once())->method('getParameters')
  4. ->willReturn(['name' => 'bar'])
  5. ;
  6. $queryBuilder->expects(self::once())->method('getParameterTypes')

    The next 24 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:461 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:569.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. ->willReturn(['name' => ParameterType::STRING])
  8. ;
  9. $statement = $this->createMock(class_exists(NextResult::class) ? NextResult::class : Result::class);
  10. $statement->expects(self::once())->method('fetchOne')->willReturn('0');
  1. }
  2. public function testConnectionCanPauseASingleTask(): void
  3. {
  4. $task = $this->createMock(TaskInterface::class);
  5. $task->expects(self::once())->method('setState')->with(self::equalTo(TaskInterface::PAUSED));

    The next 39 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:492 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:600.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $serializer = $this->createMock(SerializerInterface::class);
  7. $serializer->expects(self::never())->method('serialize');
  8. $expressionBuilder = $this->createMock(ExpressionBuilder::class);
  1. $queryBuilder->expects(self::once())->method('expr')->willReturn($expressionBuilder);
  2. $queryBuilder->expects(self::exactly(2))->method('select')
  3. ->withConsecutive([self::equalTo('t.*')], [self::equalTo('COUNT(DISTINCT t.id)')])
  4. ->willReturnSelf()
  5. ;
  6. $queryBuilder->expects(self::once())->method('where')

    The next 18 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:509 and tests/Bridge/Doctrine/Transport/ConnectionTest.php:557.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. ->with(self::equalTo('t.task_name = :name'))
  8. ;
  9. $queryBuilder->expects(self::once())->method('setParameter')
  10. ->with(self::equalTo('name'), self::equalTo('foo'))
  11. ;
  1. */
  2. private function getDBALConnectionMock()
  3. {
  4. $platform = $this->createMock(AbstractPlatform::class);
  5. $platform->method('getWriteLockSQL')->willReturn('FOR UPDATE');
  6. $platform->method('getReadLockSQL')->willReturn('FOR UPDATE');

    The next 18 lines appear both in tests/Bridge/Doctrine/Transport/ConnectionTest.php:875 and tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:740.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. $configuration = $this->createMock(Configuration::class);
  8. $driverConnection = $this->createMock(Connection::class);
  9. $driverConnection->method('getDatabasePlatform')->willReturn($platform);
  1. /**
  2. * @throws JsonException
  3. * @throws Throwable {@see TransportInterface::list()}
  4. */
  5. public function testTransportCanListTasks(): void

    The next 41 lines appear both in tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:132 and tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:181.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $serializer = $this->createMock(SerializerInterface::class);
  8. $queryBuilder = $this->createMock(QueryBuilder::class);
  9. $queryBuilder->expects(self::exactly(2))->method('select')
  1. self::assertInstanceOf(LazyTaskList::class, $list);
  2. self::assertCount(0, $list);
  3. }
  4. public function testTransportCanGetATask(): void

    The next 62 lines appear both in tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:227 and tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:294.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  5. {
  6. $task = $this->createMock(TaskInterface::class);
  7. $serializer = $this->createMock(SerializerInterface::class);
  8. $expressionBuilder = $this->createMock(ExpressionBuilder::class);
  1. }
  2. public function testTransportCanGetATask(): void
  3. {
  4. $task = $this->createMock(TaskInterface::class);
  5. $serializer = $this->createMock(SerializerInterface::class);

    The next 46 lines appear both in tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:230 and tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:534.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. $expressionBuilder = $this->createMock(ExpressionBuilder::class);
  7. $expressionBuilder->expects(self::once())->method('eq')
  8. ->with(self::equalTo('t.task_name'), self::equalTo(':name'))
  9. ->willReturn('t.task_name = :name')
  1. }
  2. public function testTransportCanGetATask(): void
  3. {
  4. $task = $this->createMock(TaskInterface::class);
  5. $serializer = $this->createMock(SerializerInterface::class);

    The next 62 lines appear both in tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:230 and tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:609.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. $expressionBuilder = $this->createMock(ExpressionBuilder::class);
  7. $expressionBuilder->expects(self::once())->method('eq')
  8. ->with(self::equalTo('t.task_name'), self::equalTo(':name'))
  9. ->willReturn('t.task_name = :name')
  1. public function testTransportCannotCreateAnExistingTask(): void
  2. {
  3. $serializer = $this->createMock(SerializerInterface::class);
  4. $task = new NullTask('foo');

    The next 42 lines appear both in tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:372 and tests/Bridge/Doctrine/Transport/DoctrineTransportTest.php:442.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Jérémy
  5. $expression = $this->createMock(ExpressionBuilder::class);
  6. $expression->expects(self::once())->method('eq')
  7. ->with(self::equalTo('t.task_name'), self::equalTo(':name'))
  8. ->willReturn('t.task_name = :name')
  1. ), $objectNormalizer,
  2. ], [new JsonEncoder()]);
  3. $objectNormalizer->setSerializer($serializer);
  4. try {
  5. $this->connection = new Connection(new InMemoryConfiguration([

    The next 22 lines appear both in tests/Bridge/Redis/Transport/ConnectionIntegrationTest.php:71 and tests/Bridge/Redis/Transport/RedisTransportIntegrationTest.php:74.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. 'host' => $dsn->getHost(),
  7. 'password' => $dsn->getPassword(),
  8. 'port' => $dsn->getPort(),
  9. 'scheme' => $dsn->getScheme(),
  10. 'timeout' => $dsn->getOption('timeout', 30),
  1. self::expectExceptionMessage('The list is not initialized');
  2. self::expectExceptionCode(0);
  3. $connection->list();
  4. }
  5. public function testConnectionCanConnectWithoutSpecificPort(): void

    The next 31 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:140 and tests/Bridge/Redis/Transport/ConnectionTest.php:170.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $serializer = $this->createMock(SerializerInterface::class);
  8. $redis = $this->createMock(Redis::class);
  9. $redis->expects(self::once())->method('connect')->with(
  1. $connection->create($taskToCreate);
  2. }
  3. public function testConnectionCannotGetUndefinedTask(): void
  4. {
  5. $serializer = $this->createMock(SerializerInterface::class);

    The next 26 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:349 and tests/Bridge/Redis/Transport/ConnectionTest.php:383.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. $redis = $this->createMock(Redis::class);
  7. $redis->expects(self::once())->method('connect');
  8. $redis->expects(self::once())->method('select')->with(self::equalTo(0))->willReturn(true);
  9. $redis->expects(self::once())->method('auth')->willReturn(true);
  1. {
  2. $serializer = $this->createMock(SerializerInterface::class);
  3. $redis = $this->createMock(Redis::class);
  4. $redis->expects(self::once())->method('connect');
  5. $redis->expects(self::once())->method('select')->with(self::equalTo(0))->willReturn(true);

    The next 24 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:353 and tests/Bridge/Redis/Transport/ConnectionTest.php:487.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $redis->expects(self::once())->method('auth')->willReturn(true);
  7. $redis->expects(self::once())->method('hExists')->willReturn(false);
  8. $connection = new Connection(new InMemoryConfiguration([
  9. 'host' => 'localhost',
  1. self::expectExceptionMessage('The task "foo" cannot be updated as it does not exist');
  2. self::expectExceptionCode(0);
  3. $connection->update('foo', $task);
  4. }
  5. public function testConnectionCannotUpdateWithError(): void

    The next 13 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:413 and tests/Bridge/Redis/Transport/ConnectionTest.php:450.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $serializer = $this->createMock(SerializerInterface::class);
  8. $serializer->expects(self::once())->method('serialize')->willReturn('foo');
  9. $task = $this->createMock(TaskInterface::class);
  1. $redis = $this->createMock(Redis::class);
  2. $redis->expects(self::once())->method('connect');
  3. $redis->expects(self::once())->method('select')->with(self::equalTo(0))->willReturn(true);
  4. $redis->expects(self::once())->method('auth')->willReturn(true);
  5. $redis->expects(self::once())->method('hExists')->willReturn(true);
  6. $redis->expects(self::once())->method('hSet')->willReturn(false);

    The next 21 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:425 and tests/Bridge/Redis/Transport/ConnectionTest.php:706.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  7. $redis->expects(self::once())->method('getLastError')->willReturn('Random error');
  8. $connection = new Connection(new InMemoryConfiguration([
  9. 'host' => 'localhost',
  10. 'timeout' => 30,
  1. $serializer = $this->createMock(SerializerInterface::class);
  2. $serializer->expects(self::once())->method('deserialize')->willReturn($task);
  3. $redis = $this->createMock(Redis::class);
  4. $redis->expects(self::once())->method('select')->with(self::equalTo(0))->willReturn(true);
  5. $redis->expects(self::once())->method('auth')->willReturn(true);

    The next 22 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:523 and tests/Bridge/Redis/Transport/ConnectionTest.php:665.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. $redis->expects(self::once())->method('hExists')->willReturn(true);
  7. $redis->expects(self::once())->method('hGet');
  8. $connection = new Connection(new InMemoryConfiguration([
  9. 'host' => 'localhost',
  1. self::expectExceptionMessage('The task "foo" is already paused');
  2. self::expectExceptionCode(0);
  3. $connection->pause('foo');
  4. }
  5. public function testConnectionCannotPauseWithUpdateException(): void

    The next 16 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:549 and tests/Bridge/Redis/Transport/ConnectionTest.php:588.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $task = $this->createMock(TaskInterface::class);
  8. $task->expects(self::once())->method('getState')->willReturn(TaskInterface::ENABLED);
  9. $task->expects(self::once())->method('setState')->with(self::equalTo(TaskInterface::PAUSED))->willReturnSelf();
  1. $task->expects(self::once())->method('getState')->willReturn(TaskInterface::ENABLED);
  2. $task->expects(self::once())->method('setState')->with(self::equalTo(TaskInterface::PAUSED))->willReturnSelf();
  3. $serializer = $this->createMock(SerializerInterface::class);
  4. $serializer->expects(self::once())->method('deserialize')->willReturn($task);
  5. $serializer->expects(self::once())->method('serialize')->with($task, 'json')->willReturn('foo');

    The next 8 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:557 and tests/Bridge/Redis/Transport/ConnectionTest.php:699.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. $redis = $this->createMock(Redis::class);
  7. $redis->expects(self::once())->method('auth')->willReturn(true);
  8. $redis->expects(self::once())->method('select')->with(self::equalTo(0))->willReturn(true);
  9. $redis->expects(self::exactly(2))->method('hExists')->willReturn(true);
  1. self::expectExceptionMessage('The task "foo" is already enabled');
  2. self::expectExceptionCode(0);
  3. $connection->resume('foo');
  4. }
  5. public function testConnectionCannotResumeTaskWithUpdateException(): void

    The next 16 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:691 and tests/Bridge/Redis/Transport/ConnectionTest.php:731.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $task = $this->createMock(TaskInterface::class);
  8. $task->expects(self::once())->method('getState')->willReturn(TaskInterface::PAUSED);
  9. $task->expects(self::once())->method('setState')->with(self::equalTo(TaskInterface::ENABLED))->willReturnSelf();
  1. }
  2. /**
  3. * @dataProvider provideList
  4. */
  5. public function testConnectionCannotEmptyWithException(string $list): void

    The next 9 lines appear both in tests/Bridge/Redis/Transport/ConnectionTest.php:833 and tests/Bridge/Redis/Transport/ConnectionTest.php:868.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $serializer = $this->createMock(SerializerInterface::class);
  8. $redis = $this->createMock(Redis::class);
  9. $redis->expects(self::once())->method('auth')->willReturn(true);
  1. public function testCommandCannotDisplayTaskOutputWithoutVeryVerbose(): void
  2. {
  3. $eventDispatcher = new EventDispatcher();
  4. $task = new NullTask('foo', [
  5. 'execution_memory_usage' => 9_507_552,

    The next 22 lines appear both in tests/Command/ConsumeTasksCommandTest.php:430 and tests/Command/ConsumeTasksCommandTest.php:561.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. ]);
  7. $scheduler = $this->createMock(SchedulerInterface::class);
  8. $scheduler->expects(self::exactly(2))->method('getDueTasks')->willReturn(new TaskList([$task]));
  1. $task = new NullTask('foo', [
  2. 'execution_memory_usage' => 9_507_552,
  3. ]);
  4. $scheduler = $this->createMock(SchedulerInterface::class);

    The next 14 lines appear both in tests/Command/ConsumeTasksCommandTest.php:433 and tests/Command/ConsumeTasksCommandTest.php:477.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $scheduler->expects(self::exactly(2))->method('getDueTasks')->willReturn(new TaskList([$task]));
  6. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  7. $runner = $this->createMock(RunnerInterface::class);
  1. $task = new NullTask('foo', [
  2. 'execution_memory_usage' => 9_507_552,
  3. ]);
  4. $scheduler = $this->createMock(SchedulerInterface::class);

    The next 25 lines appear both in tests/Command/ConsumeTasksCommandTest.php:433 and tests/Command/ConsumeTasksCommandTest.php:520.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $scheduler->expects(self::exactly(2))->method('getDueTasks')->willReturn(new TaskList([$task]));
  6. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  7. $runner = $this->createMock(RunnerInterface::class);
  1. }
  2. /**
  3. * @throws Throwable
  4. */
  5. public function testCommandCanExecuteDueTasksWithSpecificName(): void

    The next 18 lines appear both in tests/Command/ExecuteTaskCommandTest.php:194 and tests/Command/ExecuteTaskCommandTest.php:328.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $task = new NullTask('foo');
  8. $logger = $this->createMock(LoggerInterface::class);
  9. $eventDispatcher = $this->createMock(EventDispatcherInterface::class);
  1. }
  2. /**
  3. * @throws Throwable
  4. */
  5. public function testCommandCanExecuteDueTasksWithSpecificName(): void

    The next 13 lines appear both in tests/Command/ExecuteTaskCommandTest.php:194 and tests/Command/ExecuteTaskCommandTest.php:261.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $task = new NullTask('foo');
  8. $logger = $this->createMock(LoggerInterface::class);
  9. $eventDispatcher = $this->createMock(EventDispatcherInterface::class);
  1. }
  2. /**
  3. * @throws Throwable
  4. */
  5. public function testCommandCanExecuteMultipleDueTasksWithSpecificName(): void

    The next 14 lines appear both in tests/Command/ExecuteTaskCommandTest.php:227 and tests/Command/ExecuteTaskCommandTest.php:294.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $task = new NullTask('foo');
  8. $secondTask = new NullTask('bar');
  9. $logger = $this->createMock(LoggerInterface::class);
  1. * @throws Throwable
  2. */
  3. public function testCommandCanExecuteWholeTasksListWithSpecificExpression(): void
  4. {
  5. $task = new NullTask('foo');
  6. $eventDispatcher = $this->createMock(EventDispatcherInterface::class);

    The next 12 lines appear both in tests/Command/ExecuteTaskCommandTest.php:364 and tests/Command/ExecuteTaskCommandTest.php:428.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. $worker = $this->createMock(WorkerInterface::class);
  8. $worker->expects(self::once())->method('execute')->with(self::equalTo(WorkerConfiguration::create()), self::equalTo($task));
  9. $scheduler = $this->createMock(SchedulerInterface::class);
  1. $logger = $this->createMock(LoggerInterface::class);
  2. $eventDispatcher = $this->createMock(EventDispatcher::class);
  3. $eventDispatcher->expects(self::once())->method('addSubscriber')->with(new StopWorkerOnTaskLimitSubscriber(1, $logger));
  4. $task = $this->createMock(TaskInterface::class);

    The next 20 lines appear both in tests/Command/RebootSchedulerCommandTest.php:103 and tests/Command/RebootSchedulerCommandTest.php:148.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  5. $task->expects(self::exactly(3))->method('getName')->willReturn('foo');
  6. $task->expects(self::once())->method('getExpression')->willReturn('@reboot');
  7. $task->expects(self::once())->method('getState')->willReturn(TaskInterface::ENABLED);
  8. $task->expects(self::once())->method('getTags')->willReturn(['app', 'slow']);
  1. $logger = $this->createMock(LoggerInterface::class);
  2. $eventDispatcher = $this->createMock(EventDispatcher::class);
  3. $eventDispatcher->expects(self::once())->method('addSubscriber')->with(new StopWorkerOnTaskLimitSubscriber(1, $logger));
  4. $task = $this->createMock(TaskInterface::class);

    The next 16 lines appear both in tests/Command/RebootSchedulerCommandTest.php:103 and tests/Command/RebootSchedulerCommandTest.php:189.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  5. $task->expects(self::exactly(3))->method('getName')->willReturn('foo');
  6. $task->expects(self::once())->method('getExpression')->willReturn('@reboot');
  7. $task->expects(self::once())->method('getState')->willReturn(TaskInterface::ENABLED);
  8. $task->expects(self::once())->method('getTags')->willReturn(['app', 'slow']);
  1. $commandTester->execute([]);
  2. self::assertSame(Command::SUCCESS, $commandTester->getStatusCode());
  3. self::assertStringContainsString('[WARNING] The scheduler cannot be rebooted as the worker is not available', $commandTester->getDisplay());
  4. self::assertStringContainsString('The process will be retried as soon as the worker is available', $commandTester->getDisplay());
  5. self::assertStringContainsString('[OK] The scheduler have been rebooted', $commandTester->getDisplay());

    The next 13 lines appear both in tests/Command/RebootSchedulerCommandTest.php:131 and tests/Command/RebootSchedulerCommandTest.php:173.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertStringContainsString('Name', $commandTester->getDisplay());
  7. self::assertStringContainsString('foo', $commandTester->getDisplay());
  8. self::assertStringNotContainsString('bar', $commandTester->getDisplay());
  9. self::assertStringContainsString('Type', $commandTester->getDisplay());
  10. self::assertStringContainsString('State', $commandTester->getDisplay());
  1. self::assertSame(Command::FAILURE, $commandTester->getStatusCode());
  2. self::assertStringContainsString('[WARNING] The task "foo" has not been retried', $commandTester->getDisplay());
  3. }
  4. public function testCommandCanRetryTaskWithForceOption(): void

    The next 18 lines appear both in tests/Command/RetryFailedTaskCommandTest.php:133 and tests/Command/RetryFailedTaskCommandTest.php:159.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  5. {
  6. $logger = $this->createMock(LoggerInterface::class);
  7. $eventDispatcher = $this->createMock(EventDispatcherInterface::class);
  8. $eventDispatcher->expects(self::once())->method('dispatch')
  1. ],
  2. ],
  3. ],
  4. ]);
  5. self::assertArrayHasKey('probe', $configuration);

    The next 16 lines appear in tests/DependencyInjection/SchedulerBundleConfigurationTest.php:228, tests/DependencyInjection/SchedulerBundleConfigurationTest.php:294 and tests/DependencyInjection/SchedulerBundleConfigurationTest.php:365.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertTrue($configuration['probe']['enabled']);
  7. self::assertSame('/_foo', $configuration['probe']['path']);
  8. self::assertArrayHasKey('clients', $configuration['probe']);
  9. self::assertNotEmpty($configuration['probe']['clients']);
  1. self::assertArrayHasKey('bar.probe', $configuration['tasks']);
  2. self::assertSame('probe', $configuration['tasks']['bar.probe']['type']);
  3. self::assertSame('* * * * *', $configuration['tasks']['bar.probe']['expression']);
  4. }
  5. public function testConfigurationCanDefineProbeClientsWithExistingTasks(): void

    The next 34 lines appear both in tests/DependencyInjection/SchedulerBundleConfigurationTest.php:253 and tests/DependencyInjection/SchedulerBundleConfigurationTest.php:321.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $configuration = (new Processor())->processConfiguration(new SchedulerBundleConfiguration(), [
  8. 'scheduler_bundle' => [
  9. 'transport' => [
  10. 'dsn' => 'cache://memory',
  1. ],
  2. 'tasks' => [],
  3. 'lock_store' => null,
  4. ]);
  5. self::assertTrue($container->hasDefinition(Scheduler::class));

    The next 18 lines appear both in tests/DependencyInjection/SchedulerBundleExtensionTest.php:537 and tests/DependencyInjection/SchedulerBundleExtensionTest.php:580.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. self::assertTrue($container->hasAlias(SchedulerInterface::class));
  7. self::assertCount(5, $container->getDefinition(Scheduler::class)->getArguments());
  8. self::assertSame('Europe/Paris', $container->getDefinition(Scheduler::class)->getArgument(0));
  9. self::assertInstanceOf(Reference::class, $container->getDefinition(Scheduler::class)->getArgument(1));
  10. self::assertSame(TransportInterface::class, (string) $container->getDefinition(Scheduler::class)->getArgument(1));
  1. 'tasks' => [],
  2. 'lock_store' => null,
  3. ]);
  4. self::assertTrue($container->hasParameter('scheduler.scheduler_mode'));
  5. self::assertSame('lazy', $container->getParameter('scheduler.scheduler_mode'));

    The next 25 lines appear both in tests/DependencyInjection/SchedulerBundleExtensionTest.php:578 and tests/DependencyInjection/SchedulerBundleExtensionTest.php:641.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertTrue($container->hasDefinition(Scheduler::class));
  7. self::assertTrue($container->hasAlias(SchedulerInterface::class));
  8. self::assertCount(5, $container->getDefinition(Scheduler::class)->getArguments());
  9. self::assertSame('Europe/Paris', $container->getDefinition(Scheduler::class)->getArgument(0));
  1. ],
  2. 'tasks' => [],
  3. 'lock_store' => null,
  4. ]);
  5. self::assertTrue($container->hasDefinition(Worker::class));

    The next 28 lines appear both in tests/DependencyInjection/SchedulerBundleExtensionTest.php:1333 and tests/DependencyInjection/SchedulerBundleExtensionTest.php:1521.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertTrue($container->hasAlias(WorkerInterface::class));
  7. self::assertCount(8, $container->getDefinition(Worker::class)->getArguments());
  8. self::assertInstanceOf(Reference::class, $container->getDefinition(Worker::class)->getArgument(0));
  9. self::assertSame(SchedulerInterface::class, (string) $container->getDefinition(Worker::class)->getArgument(0));
  10. self::assertSame(ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $container->getDefinition(Worker::class)->getArgument(0)->getInvalidBehavior());
  1. self::assertSame(ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $container->getDefinition(Worker::class)->getArgument(6)->getInvalidBehavior());
  2. self::assertInstanceOf(Reference::class, $container->getDefinition(Worker::class)->getArgument(7));
  3. self::assertSame(LoggerInterface::class, (string) $container->getDefinition(Worker::class)->getArgument(7));
  4. self::assertSame(ContainerInterface::NULL_ON_INVALID_REFERENCE, $container->getDefinition(Worker::class)->getArgument(7)->getInvalidBehavior());
  5. self::assertFalse($container->getDefinition(Worker::class)->isPublic());
  6. self::assertCount(4, $container->getDefinition(Worker::class)->getTags());

    The next 9 lines appear both in tests/DependencyInjection/SchedulerBundleExtensionTest.php:1361 and tests/DependencyInjection/SchedulerBundleExtensionTest.php:1548.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. self::assertTrue($container->getDefinition(Worker::class)->hasTag('scheduler.worker'));
  8. self::assertTrue($container->getDefinition(Worker::class)->hasTag('monolog.logger'));
  9. self::assertSame('scheduler', $container->getDefinition(Worker::class)->getTag('monolog.logger')[0]['channel']);
  10. self::assertTrue($container->getDefinition(Worker::class)->hasTag('container.hot_path'));
  11. self::assertTrue($container->getDefinition(Worker::class)->hasTag('container.preload'));
  1. self::assertTrue($container->hasDefinition('scheduler.lock_store.factory'));
  2. self::assertSame(LockFactory::class, $container->getDefinition('scheduler.lock_store.factory')->getClass());
  3. self::assertFalse($container->getDefinition('scheduler.lock_store.factory')->isPublic());
  4. self::assertCount(1, $container->getDefinition('scheduler.lock_store.factory')->getArguments());
  5. self::assertInstanceOf(Reference::class, $container->getDefinition('scheduler.lock_store.factory')->getArgument('$store'));
  6. self::assertSame('scheduler.lock_store.store', (string) $container->getDefinition('scheduler.lock_store.factory')->getArgument('$store'));

    The next 12 lines appear both in tests/DependencyInjection/SchedulerBundleExtensionTest.php:1387 and tests/DependencyInjection/SchedulerBundleExtensionTest.php:1561.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. self::assertSame(ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $container->getDefinition('scheduler.lock_store.factory')->getArgument('$store')->getInvalidBehavior());
  8. self::assertCount(1, $container->getDefinition('scheduler.lock_store.factory')->getMethodCalls());
  9. self::assertSame('setLogger', $container->getDefinition('scheduler.lock_store.factory')->getMethodCalls()[0][0]);
  10. self::assertInstanceOf(Reference::class, $container->getDefinition('scheduler.lock_store.factory')->getMethodCalls()[0][1][0]);
  11. self::assertSame(LoggerInterface::class, (string) $container->getDefinition('scheduler.lock_store.factory')->getMethodCalls()[0][1][0]);
  1. 'expression' => '*/5 * * * *',
  2. 'description' => 'A simple cache clear task',
  3. 'options' => [
  4. 'env' => 'test',
  5. ],
  6. ], $container->getDefinition('scheduler._foo_task')->getArgument(0));

    The next 16 lines appear both in tests/DependencyInjection/SchedulerBundleExtensionTest.php:1604 and tests/DependencyInjection/SchedulerBundleExtensionTest.php:1660.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. self::assertFalse($container->getDefinition('scheduler._foo_task')->isPublic());
  8. $factory = $container->getDefinition('scheduler._foo_task')->getFactory();
  9. self::assertIsArray($factory);
  10. self::assertArrayHasKey(0, $factory);
  1. self::assertSame('scheduler.middleware', $container->getDefinition(MiddlewareRegistry::class)->getArgument(0)->getTag());
  2. self::assertCount(1, $container->getDefinition(MiddlewareRegistry::class)->getTags());
  3. self::assertTrue($container->getDefinition(MiddlewareRegistry::class)->hasTag('container.preload'));
  4. self::assertSame(MiddlewareRegistry::class, $container->getDefinition(MiddlewareRegistry::class)->getTag('container.preload')[0]['class']);
  5. self::assertTrue($container->hasAlias(SchedulerMiddlewareStackInterface::class));

    The next 14 lines appear both in tests/DependencyInjection/SchedulerBundleExtensionTest.php:1768 and tests/DependencyInjection/SchedulerBundleExtensionTest.php:1886.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertTrue($container->hasDefinition(SchedulerMiddlewareStack::class));
  7. self::assertFalse($container->getDefinition(SchedulerMiddlewareStack::class)->isPublic());
  8. self::assertCount(1, $container->getDefinition(SchedulerMiddlewareStack::class)->getArguments());
  9. self::assertInstanceOf(Reference::class, $container->getDefinition(SchedulerMiddlewareStack::class)->getArgument(0));
  10. self::assertSame(MiddlewareRegistryInterface::class, (string) $container->getDefinition(SchedulerMiddlewareStack::class)->getArgument(0));
  1. self::assertTrue($container->getDefinition(SchedulerMiddlewareStack::class)->hasTag('scheduler.middleware_hub'));
  2. self::assertTrue($container->getDefinition(SchedulerMiddlewareStack::class)->hasTag('container.hot_path'));
  3. self::assertTrue($container->getDefinition(SchedulerMiddlewareStack::class)->hasTag('container.preload'));
  4. self::assertSame(SchedulerMiddlewareStack::class, $container->getDefinition(SchedulerMiddlewareStack::class)->getTag('container.preload')[0]['class']);
  5. self::assertTrue($container->hasAlias(WorkerMiddlewareStackInterface::class));

    The next 14 lines appear both in tests/DependencyInjection/SchedulerBundleExtensionTest.php:1781 and tests/DependencyInjection/SchedulerBundleExtensionTest.php:1943.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertTrue($container->hasDefinition(WorkerMiddlewareStack::class));
  7. self::assertFalse($container->getDefinition(WorkerMiddlewareStack::class)->isPublic());
  8. self::assertCount(1, $container->getDefinition(WorkerMiddlewareStack::class)->getArguments());
  9. self::assertInstanceOf(Reference::class, $container->getDefinition(WorkerMiddlewareStack::class)->getArgument(0));
  10. self::assertSame(MiddlewareRegistryInterface::class, (string) $container->getDefinition(WorkerMiddlewareStack::class)->getArgument(0));
  1. self::assertArrayHasKey('task_filter', $request->attributes->all());
  2. self::assertSame('app.bar', $request->attributes->get('task_filter'));
  3. }
  4. public function testValidPathCanBeHandledWithValidExpression(): void

    The next 27 lines appear both in tests/EventListener/TaskSubscriberTest.php:144 and tests/EventListener/TaskSubscriberTest.php:193.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  5. {
  6. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  7. $notificationTaskBagNormalizer = new NotificationTaskBagNormalizer($objectNormalizer);
  8. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  1. $workerLifecycleSubscriber = new WorkerLifecycleSubscriber($logger);
  2. $workerLifecycleSubscriber->onWorkerRestarted(new WorkerRestartedEvent($worker));
  3. }
  4. public function testSubscriberLogOnWorkerRestarted(): void

    The next 11 lines appear in tests/EventListener/WorkerLifecycleSubscriberTest.php:92, tests/EventListener/WorkerLifecycleSubscriberTest.php:128, tests/EventListener/WorkerLifecycleSubscriberTest.php:164 and tests/EventListener/WorkerLifecycleSubscriberTest.php:199.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. {
  6. $task = $this->createMock(TaskInterface::class);
  7. $task->expects(self::once())->method('getName')->willReturn('foo');
  8. $worker = $this->createMock(WorkerInterface::class);
  1. /**
  2. * @throws Exception {@see Scheduler::__construct()}
  3. * @throws Throwable {@see SchedulerInterface::schedule()}
  4. */
  5. public function testSchedulerCanScheduleTasksWithBeforeSchedulingNotificationAndWithNotifier(): void

    The next 18 lines appear both in tests/FiberSchedulerTest.php:180 and tests/FiberSchedulerTest.php:234.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $notification = $this->createMock(Notification::class);
  8. $recipient = $this->createMock(Recipient::class);
  9. $notifier = $this->createMock(NotifierInterface::class);
  1. 'execution_mode' => 'first_in_first_out',
  2. ]), new SchedulePolicyOrchestrator([
  3. new FirstInFirstOutPolicy(),
  4. ])),
  5. new SchedulerMiddlewareStack(),
  6. new EventDispatcher()

    The next 29 lines appear both in tests/FiberSchedulerTest.php:572 and tests/SchedulerTest.php:569.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. ));
  8. $scheduler->schedule($task);
  9. $scheduler->schedule($secondTask);
  10. $scheduler->schedule($thirdTask);
  1. 'execution_mode' => 'first_in_first_out',
  2. ]), new SchedulePolicyOrchestrator([
  3. new FirstInFirstOutPolicy(),
  4. ])),
  5. new SchedulerMiddlewareStack(),
  6. new EventDispatcher()

    The next 32 lines appear both in tests/FiberSchedulerTest.php:608 and tests/SchedulerTest.php:605.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. ));
  8. $scheduler->schedule($task);
  9. $scheduler->schedule($secondTask);
  10. $scheduler->schedule($thirdTask);
  1. 'execution_mode' => 'first_in_first_out',
  2. ]), new SchedulePolicyOrchestrator([
  3. new FirstInFirstOutPolicy(),
  4. ])),
  5. new SchedulerMiddlewareStack(),
  6. new EventDispatcher()

    The next 30 lines appear both in tests/FiberSchedulerTest.php:647 and tests/SchedulerTest.php:644.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. ));
  8. $scheduler->schedule($task);
  9. $scheduler->schedule($secondTask);
  10. $scheduler->schedule($thirdTask);
  1. {
  2. $scheduler = new FiberScheduler(new Scheduler('UTC', new InMemoryTransport(new InMemoryConfiguration([
  3. 'execution_mode' => 'first_in_first_out',
  4. ]), new SchedulePolicyOrchestrator([
  5. new FirstInFirstOutPolicy(),
  6. ])), new SchedulerMiddlewareStack(), new EventDispatcher()));

    The next 23 lines appear both in tests/FiberSchedulerTest.php:816 and tests/SchedulerTest.php:813.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. $scheduler->schedule($task);
  8. self::assertInstanceOf(LazyTaskList::class, $scheduler->getTasks(true));
  9. self::assertCount(1, $scheduler->getTasks(true));
  1. $updatedTask = new NullTask('bar');
  2. $bus = $this->createMock(MessageBusInterface::class);
  3. $bus->expects(self::never())->method('dispatch');
  4. $scheduler = new FiberScheduler(new Scheduler('UTC', new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([

    The next 32 lines appear both in tests/FiberSchedulerTest.php:838 and tests/SchedulerTest.php:835.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. new FirstInFirstOutPolicy(),
  6. ])), new SchedulerMiddlewareStack(new MiddlewareRegistry([])), new EventDispatcher(), $bus));
  7. $scheduler->schedule($task);
  8. self::assertCount(1, $scheduler->getTasks());
  1. new TaskToUpdateMessageHandler($transport),
  2. ],
  3. ])),
  4. ]);
  5. $scheduler = new FiberScheduler(new Scheduler('UTC', $transport, new SchedulerMiddlewareStack(new MiddlewareRegistry([])), new EventDispatcher(), $bus));

    The next 24 lines appear both in tests/FiberSchedulerTest.php:869 and tests/SchedulerTest.php:866.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $scheduler->schedule($task);
  7. self::assertCount(1, $scheduler->getTasks());
  8. self::assertSame('* * * * *', $scheduler->getTasks()->get('foo')->getExpression());
  1. public function testTaskCanBeUpdatedThenRetrieved(TaskInterface $task): void
  2. {
  3. $bus = $this->createMock(MessageBusInterface::class);
  4. $bus->expects(self::never())->method('dispatch');
  5. $scheduler = new FiberScheduler(new Scheduler('UTC', new InMemoryTransport(new InMemoryConfiguration([

    The next 27 lines appear both in tests/FiberSchedulerTest.php:892 and tests/SchedulerTest.php:889.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. 'execution_mode' => 'first_in_first_out',
  7. ]), new SchedulePolicyOrchestrator([
  8. new FirstInFirstOutPolicy(),
  9. ])), new SchedulerMiddlewareStack(new MiddlewareRegistry([])), new EventDispatcher(), $bus));
  1. public function testTaskCanBeUpdatedThenLazilyRetrieved(TaskInterface $task): void
  2. {
  3. $bus = $this->createMock(MessageBusInterface::class);
  4. $bus->expects(self::never())->method('dispatch');
  5. $scheduler = new FiberScheduler(new Scheduler('UTC', new InMemoryTransport(new InMemoryConfiguration([

    The next 29 lines appear both in tests/FiberSchedulerTest.php:918 and tests/SchedulerTest.php:915.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. 'execution_mode' => 'first_in_first_out',
  7. ]), new SchedulePolicyOrchestrator([
  8. new FirstInFirstOutPolicy(),
  9. ])), new SchedulerMiddlewareStack(new MiddlewareRegistry([])), new EventDispatcher(), $bus));
  1. $scheduler = new FiberScheduler(new Scheduler('UTC', new InMemoryTransport(new InMemoryConfiguration([
  2. 'execution_mode' => 'first_in_first_out',
  3. ]), new SchedulePolicyOrchestrator([
  4. new FirstInFirstOutPolicy(),
  5. ])), new SchedulerMiddlewareStack([]), new EventDispatcher()));

    The next 45 lines appear both in tests/FiberSchedulerTest.php:1419 and tests/SchedulerTest.php:1417.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $scheduler->schedule(new NullTask('foo'));
  7. $list = $scheduler->getTasks();
  8. self::assertCount(1, $list);
  1. $worker = new Worker($scheduler, new RunnerRegistry([
  2. new NullTaskRunner(),
  3. ]), new ExecutionPolicyRegistry([
  4. new DefaultPolicy(),
  5. ]), new TaskExecutionTracker(new Stopwatch()), new WorkerMiddlewareStack([
  6. new SingleRunTaskMiddleware($transport),

    The next 38 lines appear both in tests/FiberSchedulerTest.php:1665 and tests/LazySchedulerTest.php:728.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  7. new TaskUpdateMiddleware($transport),
  8. new TaskLockBagMiddleware($lockFactory),
  9. ]), $eventDispatcher, $lockFactory, $logger);
  10. $worker->execute(WorkerConfiguration::create());
  1. self::assertFalse($scheduler->isInitialized());
  2. $scheduler->schedule(new NullTask('foo'));
  3. $scheduler->schedule(new NullTask('bar'));
  4. $scheduler->schedule(new NullTask('reboot'));
  5. $scheduler->preempt('foo', static fn (TaskInterface $task): bool => $task->getName() === 'reboot');

    The next 94 lines appear both in tests/LazySchedulerTest.php:719 and tests/SchedulerTest.php:1648.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $lockFactory = new LockFactory(new InMemoryStore());
  7. $worker = new Worker($scheduler, new RunnerRegistry([
  8. new NullTaskRunner(),
  1. $schedulerMiddlewareStack = new FiberAwareSchedulerMiddlewareStack(new SchedulerMiddlewareStack(new MiddlewareRegistry([
  2. $middleware,
  3. $secondMiddleware,
  4. ])), $logger);
  5. $schedulerMiddlewareStack->runPreSchedulingMiddleware($task, $scheduler);

    The next 19 lines appear both in tests/Middleware/FiberAwareSchedulerMiddlewareStackTest.php:79 and tests/Middleware/SchedulerMiddlewareStackTest.php:69.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. }
  7. /**
  8. * @throws Throwable {@see SchedulerMiddlewareStack::runPreSchedulingMiddleware()}
  9. */
  1. $secondMiddleware,
  2. $thirdMiddleware,
  3. $fourthMiddleware,
  4. ])), $logger);
  5. self::expectException(RuntimeException::class);

    The next 35 lines appear both in tests/Middleware/FiberAwareSchedulerMiddlewareStackTest.php:121 and tests/Middleware/SchedulerMiddlewareStackTest.php:108.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::expectExceptionMessage('An error occurred');
  7. self::expectExceptionCode(0);
  8. $schedulerMiddlewareStack->runPreSchedulingMiddleware($task, $scheduler);
  9. }
  1. $thirdOrderedMiddleware->expects(self::exactly(2))->method('getPriority')->willReturn(0);
  2. $thirdOrderedMiddleware->expects(self::once())->method('preScheduling')->with(self::equalTo($task), self::equalTo($scheduler));
  3. $fourthOrderedMiddleware = $this->createMock(OrderedMiddleware::class);
  4. $fourthOrderedMiddleware->expects(self::exactly(2))->method('getPriority')->willReturn(1);
  5. $fourthOrderedMiddleware->expects(self::once())->method('preScheduling')->with(self::equalTo($task), self::equalTo($scheduler));

    The next 15 lines appear both in tests/Middleware/FiberAwareSchedulerMiddlewareStackTest.php:149 and tests/Middleware/FiberAwareSchedulerMiddlewareStackTest.php:182.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $middleware = $this->createMock(PreSchedulingMiddlewareInterface::class);
  7. $middleware->expects(self::once())->method('preScheduling')->with(self::equalTo($task), self::equalTo($scheduler));
  8. $secondMiddleware = $this->createMock(PostSchedulingMiddlewareInterface::class);
  1. $secondOrderedMiddleware,
  2. $thirdOrderedMiddleware,
  3. $fourthOrderedMiddleware,
  4. ])), $logger);
  5. $schedulerMiddlewareStack->runPreSchedulingMiddleware($task, $scheduler);

    The next 20 lines appear both in tests/Middleware/FiberAwareSchedulerMiddlewareStackTest.php:169 and tests/Middleware/SchedulerMiddlewareStackTest.php:153.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. }
  7. /**
  8. * @throws Throwable {@see SchedulerMiddlewareStack::runPreSchedulingMiddleware()}
  9. */
  1. self::assertSame(Output::ERROR, $output->getType());
  2. self::assertNull($output->getOutput());
  3. self::assertInstanceOf(ShellTask::class, $output->getTask());
  4. }
  5. public function testApplicationCanReturnValidCode(): void

    The next 11 lines appear both in tests/Runner/CommandTaskRunnerTest.php:48 and tests/Runner/CommandTaskRunnerTest.php:69.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $worker = $this->createMock(WorkerInterface::class);
  8. $commandTask = new CommandTask('foo', 'app:foo');
  1. self::assertSame('The probe state is invalid', $output->getOutput());
  2. self::assertInstanceOf(ProbeTask::class, $output->getTask());
  3. self::assertNull($output->getTask()->getExecutionState());
  4. }
  5. public function testRunnerCanRunTaskWithInvalidProbeStateAndTaskFailureEnabled(): void

    The next 17 lines appear both in tests/Runner/ProbeTaskRunnerTest.php:64 and tests/Runner/ProbeTaskRunnerTest.php:88.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $worker = $this->createMock(WorkerInterface::class);
  8. $response = $this->createMock(ResponseInterface::class);
  9. $response->expects(self::once())->method('toArray')->with(self::equalTo(true))->willReturn([
  1. /**
  2. * @throws Exception {@see Scheduler::__construct()}
  3. * @throws Throwable {@see SchedulerInterface::schedule()}
  4. */
  5. public function testSchedulerCanScheduleTasksWithBeforeSchedulingNotificationAndWithNotifier(): void

    The next 18 lines appear both in tests/SchedulerTest.php:175 and tests/SchedulerTest.php:229.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $notification = $this->createMock(Notification::class);
  8. $recipient = $this->createMock(Recipient::class);
  9. $notifier = $this->createMock(NotifierInterface::class);
  1. self::assertFalse($normalizer->supportsNormalization(new stdClass()));
  2. self::assertTrue($normalizer->supportsNormalization(new SchedulerConfiguration(new DateTimeZone('UTC'), new DateTimeImmutable(), new NullTask('foo'))));
  3. }
  4. public function testNormalizerCanNormalize(): void

    The next 31 lines appear both in tests/Serializer/SchedulerConfigurationNormalizerTest.php:48 and tests/Serializer/SchedulerConfigurationNormalizerTest.php:103.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. {
  6. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  7. $notificationTaskBagNormalizer = new NotificationTaskBagNormalizer($objectNormalizer);
  8. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  1. ]));
  2. self::assertSame('nice', $cacheTransport->getExecutionMode());
  3. }
  4. public function testTransportCannotReturnUndefinedTask(): void

    The next 29 lines appear both in tests/Transport/CacheTransportTest.php:72 and tests/Transport/CacheTransportTest.php:278.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. {
  6. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  7. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  8. $serializer = new Serializer([
  1. $cacheTransport->update('foo', new ShellTask('foo', []));
  2. self::assertInstanceOf(ShellTask::class, $cacheTransport->get('foo'));
  3. }
  4. public function testTransportCannotPauseAlreadyPausedTask(): void

    The next 27 lines appear both in tests/Transport/CacheTransportTest.php:340 and tests/Transport/CacheTransportTest.php:436.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. {
  6. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  7. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  8. $serializer = new Serializer([
  1. $cacheTransport->update('foo', new ShellTask('foo', []));
  2. self::assertInstanceOf(ShellTask::class, $cacheTransport->get('foo'));
  3. }
  4. public function testTransportCannotPauseAlreadyPausedTask(): void

    The next 28 lines appear both in tests/Transport/CacheTransportTest.php:340 and tests/Transport/CacheTransportTest.php:374.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. {
  6. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  7. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  8. $serializer = new Serializer([
  1. }
  2. /**
  3. * @throws Throwable {@see TransportInterface::list()}
  4. */
  5. public function testTransportCannotDeleteUndefinedTask(): void

    The next 29 lines appear both in tests/Transport/CacheTransportTest.php:471 and tests/Transport/CacheTransportTest.php:512.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  8. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  9. $serializer = new Serializer([
  1. self::expectExceptionMessage('All the transports failed to execute the requested action');
  2. self::expectExceptionCode(0);
  3. $failOverTransport->get('foo');
  4. }
  5. public function testTransportCanRetrieveTask(): void

    The next 21 lines appear both in tests/Transport/FailOverTransportTest.php:94 and tests/Transport/FailOverTransportTest.php:117.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $firstTransport = $this->createMock(TransportInterface::class);
  8. $firstTransport->expects(self::once())->method('get')
  9. ->with(self::equalTo('foo'), self::equalTo(false))
  10. ->willThrowException(new RuntimeException('Task not found'))
  1. ]), new InMemoryConfiguration());
  2. self::expectException(TransportException::class);
  3. self::expectExceptionMessage('All the transports failed to execute the requested action');
  4. self::expectExceptionCode(0);
  5. $failOverTransport->update('foo', $task);

    The next 16 lines appear both in tests/Transport/FailOverTransportTest.php:410 and tests/Transport/RoundRobinTransportTest.php:376.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. }
  7. public function testTransportCanUpdateTask(): void
  8. {
  9. $task = $this->createMock(TaskInterface::class);
  1. self::expectException(InvalidArgumentException::class);
  2. self::expectExceptionMessage('The "bar" task does not exist');
  3. $filesystemTransport->get('bar');
  4. }
  5. public function testTaskCanBeRetrieved(): void

    The next 32 lines appear both in tests/Transport/FilesystemTransportTest.php:249 and tests/Transport/FilesystemTransportTest.php:472.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  8. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  9. $serializer = new Serializer([
  1. self::expectException(InvalidArgumentException::class);
  2. self::expectExceptionMessage('The "bar" task does not exist');
  3. $filesystemTransport->get('bar');
  4. }
  5. public function testTaskCanBeRetrieved(): void

    The next 29 lines appear both in tests/Transport/FilesystemTransportTest.php:249 and tests/Transport/FilesystemTransportTest.php:328.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  8. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  9. $serializer = new Serializer([
  1. self::expectException(InvalidArgumentException::class);
  2. self::expectExceptionMessage('The "bar" task does not exist');
  3. $filesystemTransport->get('bar');
  4. }
  5. public function testTaskCanBeRetrieved(): void

    The next 35 lines appear in tests/Transport/FilesystemTransportTest.php:249, tests/Transport/FilesystemTransportTest.php:513 and tests/Transport/FilesystemTransportTest.php:550.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  8. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  9. $serializer = new Serializer([
  1. self::expectException(InvalidArgumentException::class);
  2. self::expectExceptionMessage('The "bar" task does not exist');
  3. $filesystemTransport->get('bar');
  4. }
  5. public function testTaskCanBeRetrieved(): void

    The next 30 lines appear in tests/Transport/FilesystemTransportTest.php:249, tests/Transport/FilesystemTransportTest.php:286 and tests/Transport/FilesystemTransportTest.php:437.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  8. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  9. $serializer = new Serializer([
  1. self::expectException(InvalidArgumentException::class);
  2. self::expectExceptionMessage('The "bar" task does not exist');
  3. $filesystemTransport->get('bar');
  4. }
  5. public function testTaskCanBeRetrieved(): void

    The next 38 lines appear both in tests/Transport/FilesystemTransportTest.php:249 and tests/Transport/FilesystemTransportTest.php:595.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $objectNormalizer = new ObjectNormalizer(null, null, null, new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]));
  8. $lockTaskBagNormalizer = new AccessLockBagNormalizer($objectNormalizer);
  9. $serializer = new Serializer([
  1. }
  2. /**
  3. * @throws Throwable {@see TransportInterface::list()}
  4. */
  5. public function testTransportCannotReturnAListWithFailingTransports(): void

    The next 29 lines appear both in tests/Transport/LongTailTransportTest.php:157 and tests/Transport/LongTailTransportTest.php:186.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Loulier Guillaume
  6. {
  7. $secondTaskList = new TaskList([
  8. new NullTask('foo'),
  9. ]);
  1. new TaskLockBagMiddleware($lockFactory),
  2. ]), $eventDispatcher, $lockFactory, $logger);
  3. $configuration = WorkerConfiguration::create();
  4. $configuration->setExecutionPolicy('fiber');
  5. $configuration->stop();

    The next 15 lines appear both in tests/Worker/FiberWorkerTest.php:128 and tests/Worker/WorkerTest.php:121.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $worker->execute($configuration);
  7. self::assertSame(0, $worker->getConfiguration()->getExecutedTasksCount());
  8. self::assertNull($worker->getConfiguration()->getForkedFrom());
  1. new TaskLockBagMiddleware($lockFactory),
  2. ]), $eventDispatcher, $lockFactory, new NullLogger());
  3. $configuration = WorkerConfiguration::create();
  4. $configuration->setExecutionPolicy('fiber');
  5. $configuration->setSleepDurationDelay(5);

    The next 44 lines appear both in tests/Worker/FiberWorkerTest.php:170 and tests/Worker/WorkerTest.php:162.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $worker->execute($configuration);
  7. $forkedWorker = $worker->fork();
  8. self::assertNotSame($forkedWorker, $worker);
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertNull($worker->getLastExecutedTask());

    The next 35 lines appear both in tests/Worker/FiberWorkerTest.php:224 and tests/Worker/WorkerTest.php:212.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(1, $worker->getFailedTasks());
  6. $failedTask = $worker->getFailedTasks()->get('foo.failed');
  7. self::assertInstanceOf(FailedTask::class, $failedTask);
  1. new TaskLockBagMiddleware($lockFactory),
  2. ]), $eventDispatcher, $lockFactory, $logger);
  3. $configuration = WorkerConfiguration::create();
  4. $configuration->setExecutionPolicy('fiber');
  5. $configuration->stop();

    The next 50 lines appear both in tests/Worker/FiberWorkerTest.php:266 and tests/Worker/WorkerTest.php:253.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $worker->execute($configuration);
  7. self::assertNull($worker->getLastExecutedTask());
  8. self::assertTrue($worker->getConfiguration()->shouldStop());
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertNull($task->getExecutionState());

    The next 39 lines appear both in tests/Worker/FiberWorkerTest.php:326 and tests/Worker/WorkerTest.php:310.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertSame(TaskInterface::SUCCEED, $secondTask->getExecutionState());
  6. self::assertSame($secondTask, $worker->getLastExecutedTask());
  7. }
  8. /**
  1. {
  2. $task = new NullTask('foo', [
  3. 'execution_delay' => 1_000_000,
  4. ]);
  5. $logger = $this->createMock(LoggerInterface::class);

    The next 26 lines appear both in tests/Worker/FiberWorkerTest.php:342 and tests/Worker/FiberWorkerTest.php:584.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $logger->expects(self::never())->method('info');
  7. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  8. $tracker->expects(self::once())->method('startTracking');
  9. $tracker->expects(self::once())->method('endTracking');
  1. {
  2. $task = new NullTask('foo', [
  3. 'execution_delay' => 1_000_000,
  4. ]);
  5. $logger = $this->createMock(LoggerInterface::class);

    The next 39 lines appear both in tests/Worker/FiberWorkerTest.php:342 and tests/Worker/FiberWorkerTest.php:723.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $logger->expects(self::never())->method('info');
  7. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  8. $tracker->expects(self::once())->method('startTracking');
  9. $tracker->expects(self::once())->method('endTracking');
  1. ]);
  2. $logger = $this->createMock(LoggerInterface::class);
  3. $logger->expects(self::never())->method('info');
  4. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);

    The next 39 lines appear both in tests/Worker/FiberWorkerTest.php:345 and tests/Worker/FiberWorkerTest.php:923.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $tracker->expects(self::once())->method('startTracking');
  6. $tracker->expects(self::once())->method('endTracking');
  7. $transport = new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([
  8. new FirstInFirstOutPolicy(),
  1. ]);
  2. $logger = $this->createMock(LoggerInterface::class);
  3. $logger->expects(self::never())->method('info');
  4. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);

    The next 24 lines appear both in tests/Worker/FiberWorkerTest.php:345 and tests/Worker/FiberWorkerTest.php:870.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $tracker->expects(self::once())->method('startTracking');
  6. $tracker->expects(self::once())->method('endTracking');
  7. $transport = new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([
  8. new FirstInFirstOutPolicy(),
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 35 lines appear both in tests/Worker/FiberWorkerTest.php:374 and tests/Worker/WorkerTest.php:355.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. }
  6. /**
  7. * @throws Throwable
  8. */
  1. $logger = $this->createMock(LoggerInterface::class);
  2. $logger->expects(self::never())->method('info');
  3. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  4. $tracker->expects(self::never())->method('startTracking')->with(self::equalTo($task));
  5. $tracker->expects(self::never())->method('endTracking')->with(self::equalTo($task));

    The next 29 lines appear both in tests/Worker/FiberWorkerTest.php:391 and tests/Worker/FiberWorkerTest.php:490.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $transport = new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([
  7. new FirstInFirstOutPolicy(),
  8. ]));
  1. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  2. $tracker->expects(self::never())->method('startTracking')->with(self::equalTo($task));
  3. $tracker->expects(self::never())->method('endTracking')->with(self::equalTo($task));
  4. $transport = new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([

    The next 27 lines appear both in tests/Worker/FiberWorkerTest.php:393 and tests/Worker/FiberWorkerTest.php:591.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. new FirstInFirstOutPolicy(),
  6. ]));
  7. $scheduler = new Scheduler('UTC', $transport, new SchedulerMiddlewareStack(), new EventDispatcher());
  8. $scheduler->schedule($task);
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertNull($worker->getLastExecutedTask());

    The next 41 lines appear both in tests/Worker/FiberWorkerTest.php:419 and tests/Worker/WorkerTest.php:397.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(1, $worker->getFailedTasks());
  6. }
  7. /**
  8. * @throws Throwable {@see TaskListInterface::add()}
  1. $scheduler->schedule($validTask);
  2. $eventDispatcher = new EventDispatcher();
  3. $eventDispatcher->addSubscriber(new StopWorkerOnTaskLimitSubscriber(2));
  4. $lockFactory = new LockFactory(new InMemoryStore());

    The next 26 lines appear both in tests/Worker/FiberWorkerTest.php:454 and tests/Worker/FiberWorkerTest.php:553.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $worker = new Worker($scheduler, new RunnerRegistry([
  6. new NullTaskRunner(),
  7. ]), new ExecutionPolicyRegistry([
  8. new FiberPolicy(),
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertCount(1, $worker->getFailedTasks());

    The next 38 lines appear both in tests/Worker/FiberWorkerTest.php:470 and tests/Worker/WorkerTest.php:445.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertInstanceOf(FailedTask::class, $worker->getFailedTasks()->get('foo.failed'));
  6. self::assertNotNull($worker->getLastExecutedTask());
  7. self::assertSame($validTask, $worker->getLastExecutedTask());
  8. }
  1. {
  2. $task = new NullTask('foo', [
  3. 'before_executing' => static fn (): bool => true,
  4. ]);
  5. $logger = $this->createMock(LoggerInterface::class);

    The next 25 lines appear both in tests/Worker/FiberWorkerTest.php:485 and tests/Worker/FiberWorkerTest.php:1111.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $logger->expects(self::never())->method('info');
  7. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  8. $tracker->expects(self::once())->method('startTracking')->with(self::equalTo($task));
  9. $tracker->expects(self::once())->method('endTracking')->with(self::equalTo($task));
  1. {
  2. $task = new NullTask('foo', [
  3. 'before_executing' => static fn (): bool => true,
  4. ]);
  5. $logger = $this->createMock(LoggerInterface::class);

    The next 12 lines appear both in tests/Worker/FiberWorkerTest.php:485 and tests/Worker/FiberWorkerTest.php:1219.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $logger->expects(self::never())->method('info');
  7. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  8. $tracker->expects(self::once())->method('startTracking')->with(self::equalTo($task));
  9. $tracker->expects(self::once())->method('endTracking')->with(self::equalTo($task));
  1. {
  2. $task = new NullTask('foo', [
  3. 'before_executing' => static fn (): bool => true,
  4. ]);
  5. $logger = $this->createMock(LoggerInterface::class);

    The next 41 lines appear both in tests/Worker/FiberWorkerTest.php:485 and tests/Worker/FiberWorkerTest.php:1163.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $logger->expects(self::never())->method('info');
  7. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  8. $tracker->expects(self::once())->method('startTracking')->with(self::equalTo($task));
  9. $tracker->expects(self::once())->method('endTracking')->with(self::equalTo($task));
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 41 lines appear both in tests/Worker/FiberWorkerTest.php:518 and tests/Worker/WorkerTest.php:490.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(0, $worker->getFailedTasks());
  6. }
  7. /**
  8. * @throws Throwable {@see TaskListInterface::add()}
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertCount(1, $worker->getFailedTasks());

    The next 41 lines appear both in tests/Worker/FiberWorkerTest.php:569 and tests/Worker/WorkerTest.php:538.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertInstanceOf(FailedTask::class, $worker->getFailedTasks()->get('foo.failed'));
  6. self::assertNotNull($worker->getLastExecutedTask());
  7. self::assertSame($validTask, $worker->getLastExecutedTask());
  8. }
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertCount(0, $worker->getFailedTasks());

    The next 30 lines appear both in tests/Worker/FiberWorkerTest.php:617 and tests/Worker/WorkerTest.php:583.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertSame($task, $worker->getLastExecutedTask());
  6. }
  7. /**
  8. * @throws Throwable {@see TaskListInterface::add()}
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame(1, $worker->getConfiguration()->getExecutedTasksCount());

    The next 37 lines appear both in tests/Worker/FiberWorkerTest.php:661 and tests/Worker/WorkerTest.php:624.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertInstanceOf(NullTask::class, $worker->getLastExecutedTask());
  6. $task = $scheduler->getTasks()->get('foo');
  7. self::assertFalse($task->isSingleRun());
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame(0, $worker->getConfiguration()->getExecutedTasksCount());

    The next 47 lines appear both in tests/Worker/FiberWorkerTest.php:712 and tests/Worker/WorkerTest.php:672.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertNull($worker->getLastExecutedTask());
  6. }
  7. /**
  8. * @throws Throwable {@see TaskListInterface::add()}
  1. }
  2. /**
  3. * @throws Throwable {@see TaskListInterface::add()}
  4. */
  5. public function testTaskCanBeExecutedAndTheWorkerCanReturnTheLastExecutedTask(): void

    The next 29 lines appear both in tests/Worker/FiberWorkerTest.php:719 and tests/Worker/FiberWorkerTest.php:1062.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $task = new NullTask('foo');
  8. $logger = $this->createMock(LoggerInterface::class);
  9. $logger->expects(self::never())->method('info');
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 40 lines appear both in tests/Worker/FiberWorkerTest.php:755 and tests/Worker/WorkerTest.php:712.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. }
  6. /**
  7. * @throws Throwable {@see TaskListInterface::add()}
  8. */
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($shellTask, $worker->getLastExecutedTask());

    The next 34 lines appear both in tests/Worker/FiberWorkerTest.php:804 and tests/Worker/WorkerTest.php:758.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. }
  6. /**
  7. * @throws Throwable {@see TaskListInterface::add()}
  8. */
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. $failedTasks = $worker->getFailedTasks();

    The next 48 lines appear both in tests/Worker/FiberWorkerTest.php:846 and tests/Worker/WorkerTest.php:797.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(1, $failedTasks);
  6. $failedTask = $failedTasks->get('foo.failed');
  7. self::assertInstanceOf(FailedTask::class, $failedTask);
  8. self::assertNotEmpty($worker->getFailedTasks());
  1. }
  2. /**
  3. * @throws Throwable {@see TaskListInterface::add()}
  4. */
  5. public function testTaskCanBeExecutedWithoutBeforeExecutionNotificationAndNotifier(): void

    The next 49 lines appear both in tests/Worker/FiberWorkerTest.php:860 and tests/Worker/FiberWorkerTest.php:961.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $task = new NullTask('foo');
  8. $logger = $this->createMock(LoggerInterface::class);
  9. $logger->expects(self::never())->method('info');
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 58 lines appear both in tests/Worker/FiberWorkerTest.php:901 and tests/Worker/WorkerTest.php:849.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(0, $worker->getFailedTasks());
  6. }
  7. /**
  8. * @throws Throwable {@see TaskListInterface::add()}
  1. ]);
  2. $logger = $this->createMock(LoggerInterface::class);
  3. $logger->expects(self::never())->method('info');
  4. $notifier = $this->createMock(NotifierInterface::class);

    The next 28 lines appear both in tests/Worker/FiberWorkerTest.php:920 and tests/Worker/FiberWorkerTest.php:1021.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $notifier->expects(self::once())->method('send')->with(self::equalTo($notification), $recipient);
  6. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  7. $tracker->expects(self::once())->method('startTracking');
  8. $tracker->expects(self::once())->method('endTracking');
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 53 lines appear both in tests/Worker/FiberWorkerTest.php:954 and tests/Worker/WorkerTest.php:899.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(0, $worker->getFailedTasks());
  6. }
  7. /**
  8. * @throws Throwable
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 47 lines appear both in tests/Worker/FiberWorkerTest.php:1002 and tests/Worker/WorkerTest.php:944.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(0, $worker->getFailedTasks());
  6. }
  7. /**
  8. * @throws Throwable
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 36 lines appear both in tests/Worker/FiberWorkerTest.php:1055 and tests/Worker/WorkerTest.php:994.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(0, $worker->getFailedTasks());
  6. }
  7. /**
  8. * @throws Throwable
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 37 lines appear both in tests/Worker/FiberWorkerTest.php:1099 and tests/Worker/WorkerTest.php:1035.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. }
  6. /**
  7. * @throws Throwable
  8. */
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 51 lines appear both in tests/Worker/FiberWorkerTest.php:1151 and tests/Worker/WorkerTest.php:1084.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. }
  6. /**
  7. * @throws Throwable
  8. */
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertNull($worker->getLastExecutedTask());

    The next 38 lines appear both in tests/Worker/FiberWorkerTest.php:1203 and tests/Worker/WorkerTest.php:1134.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(1, $worker->getFailedTasks());
  6. $failedTask = $worker->getFailedTasks()->get('foo.failed');
  7. self::assertInstanceOf(FailedTask::class, $failedTask);
  8. self::assertSame($task, $failedTask->getTask());
  1. new TaskLockBagMiddleware($lockFactory),
  2. ]), $eventDispatcher, $lockFactory, $logger);
  3. $configuration = WorkerConfiguration::create();
  4. $configuration->setExecutionPolicy('fiber');
  5. $worker->execute($configuration, $task);

    The next 39 lines appear both in tests/Worker/FiberWorkerTest.php:1248 and tests/Worker/WorkerTest.php:1176.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertCount(0, $worker->getFailedTasks());
  7. self::assertSame($task, $worker->getLastExecutedTask());
  8. }
  1. new TaskLockBagMiddleware($lockFactory),
  2. ]), $eventDispatcher, $lockFactory, $logger);
  3. $configuration = WorkerConfiguration::create();
  4. $configuration->setExecutionPolicy('fiber');
  5. $worker->execute($configuration, $task);

    The next 54 lines appear both in tests/Worker/FiberWorkerTest.php:1294 and tests/Worker/WorkerTest.php:1220.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertCount(1, $worker->getFailedTasks());
  7. self::assertNull($worker->getLastExecutedTask());
  8. }
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertNull($worker->getLastExecutedTask());

    The next 34 lines appear both in tests/Worker/FiberWorkerTest.php:1358 and tests/Worker/WorkerTest.php:1281.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. }
  6. /**
  7. * @throws Throwable
  8. */
  1. }
  2. /**
  3. * @throws Throwable
  4. */
  5. public function testWorkerCanExecuteChainedTasks(): void

    The next 36 lines appear both in tests/Worker/FiberWorkerTest.php:1364 and tests/Worker/FiberWorkerTest.php:1427.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $chainedTask = new ChainedTask(
  8. 'foo',
  9. new ShellTask('chained_foo', ['ls', '-al']),
  10. new ShellTask('chained_bar', ['ls', '-al'])
  1. new TaskLockBagMiddleware($lockFactory),
  2. ]), $eventDispatcher, $lockFactory, $logger);
  3. $configuration = WorkerConfiguration::create();
  4. $configuration->setExecutionPolicy('fiber');
  5. $worker->execute($configuration);

    The next 30 lines appear both in tests/Worker/FiberWorkerTest.php:1400 and tests/Worker/FiberWorkerTest.php:1464.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. self::assertSame($shellTask, $worker->getLastExecutedTask());
  7. self::assertSame(TaskInterface::SUCCEED, $chainedTask->getExecutionState());
  8. self::assertNotNull($chainedTask->getExecutionStartTime());
  9. self::assertNotNull($chainedTask->getExecutionEndTime());
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($shellTask, $worker->getLastExecutedTask());

    The next 57 lines appear both in tests/Worker/FiberWorkerTest.php:1402 and tests/Worker/WorkerTest.php:1321.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertSame(TaskInterface::SUCCEED, $chainedTask->getExecutionState());
  6. self::assertNotNull($chainedTask->getExecutionStartTime());
  7. self::assertNotNull($chainedTask->getExecutionEndTime());
  8. $chainedFooTask = $chainedTask->getTask('chained_foo');
  1. new TaskLockBagMiddleware($lockFactory),
  2. ]), $eventDispatcher, $lockFactory, $logger);
  3. $configuration = WorkerConfiguration::create();
  4. $configuration->setExecutionPolicy('fiber');
  5. $configuration->mustRetrieveTasksLazily(true);

    The next 58 lines appear both in tests/Worker/FiberWorkerTest.php:1463 and tests/Worker/WorkerTest.php:1380.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $worker->execute($configuration);
  7. self::assertSame($shellTask, $worker->getLastExecutedTask());
  8. self::assertSame(TaskInterface::SUCCEED, $chainedTask->getExecutionState());
  9. self::assertNotNull($chainedTask->getExecutionStartTime());
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertSame($task, $worker->getLastExecutedTask());

    The next 34 lines appear both in tests/Worker/FiberWorkerTest.php:1530 and tests/Worker/WorkerTest.php:1446.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertNull($task->getAccessLockBag());
  6. self::assertFalse($worker->getConfiguration()->isRunning());
  7. self::assertSame(1, $worker->getConfiguration()->getExecutedTasksCount());
  8. }
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertCount(0, $worker->getFailedTasks());

    The next 26 lines appear both in tests/Worker/FiberWorkerTest.php:1575 and tests/Worker/WorkerTest.php:1489.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertSame($task, $worker->getLastExecutedTask());
  6. self::assertFalse($worker->getConfiguration()->isRunning());
  7. self::assertSame(1, $worker->getConfiguration()->getExecutedTasksCount());
  8. }
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertCount(0, $worker->getFailedTasks());

    The next 28 lines appear both in tests/Worker/FiberWorkerTest.php:1612 and tests/Worker/WorkerTest.php:1524.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertNull($worker->getLastExecutedTask());
  6. self::assertTrue($worker->getConfiguration()->shouldStop());
  7. self::assertFalse($worker->getConfiguration()->isRunning());
  8. self::assertSame(0, $worker->getConfiguration()->getExecutedTasksCount());
  9. }
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertCount(1, $worker->getFailedTasks());

    The next 27 lines appear both in tests/Worker/FiberWorkerTest.php:1650 and tests/Worker/WorkerTest.php:1560.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertNull($worker->getLastExecutedTask());
  6. self::assertFalse($worker->getConfiguration()->isRunning());
  7. self::assertSame(0, $worker->getConfiguration()->getExecutedTasksCount());
  8. }
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertCount(0, $worker->getFailedTasks());

    The next 46 lines appear both in tests/Worker/FiberWorkerTest.php:1696 and tests/Worker/WorkerTest.php:1602.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertFalse($worker->getConfiguration()->isRunning());
  6. self::assertNull($worker->getLastExecutedTask());
  7. self::assertSame(0, $worker->getConfiguration()->getExecutedTasksCount());
  8. self::assertSame(0, $worker->getConfiguration()->getExecutedTasksCount());
  9. }
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertCount(0, $worker->getFailedTasks());

    The next 38 lines appear both in tests/Worker/FiberWorkerTest.php:1754 and tests/Worker/WorkerTest.php:1657.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertSame(1, $worker->getConfiguration()->getExecutedTasksCount());
  6. self::assertFalse($worker->isRunning());
  7. }
  8. /**
  1. $configuration = WorkerConfiguration::create();
  2. $configuration->setExecutionPolicy('fiber');
  3. $worker->execute($configuration);
  4. self::assertFalse($worker->isRunning());

    The next 25 lines appear both in tests/Worker/FiberWorkerTest.php:1805 and tests/Worker/WorkerTest.php:1706.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. self::assertCount(0, $worker->getFailedTasks());
  6. self::assertTrue($worker->getConfiguration()->shouldStop());
  7. }
  8. /**
  1. }
  2. /**
  3. * @throws Throwable {@see WorkerInterface::preempt()}
  4. */
  5. public function testWorkerCanPreempt(): void

    The next 30 lines appear both in tests/Worker/FiberWorkerTest.php:1813 and tests/Worker/FiberWorkerTest.php:1862.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $logger = $this->createMock(LoggerInterface::class);
  8. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  9. $transport = new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([
  1. new TaskUpdateMiddleware($transport),
  2. new TaskLockBagMiddleware($lockFactory),
  3. ]), new EventDispatcher(), $lockFactory, $logger);
  4. $worker->getConfiguration()->setExecutionPolicy('fiber');
  5. $barTask = new NullTask('bar');

    The next 41 lines appear both in tests/Worker/FiberWorkerTest.php:1838 and tests/Worker/WorkerTest.php:1737.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $randomTask = new NullTask('random');
  7. $preemptList = new TaskList([
  8. new NullTask('foo'),
  9. $barTask,
  1. $logger = $this->createMock(LoggerInterface::class);
  2. $logger->expects(self::never())->method('info');
  3. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  4. $tracker->expects(self::never())->method('startTracking')->with(self::equalTo($task));
  5. $tracker->expects(self::never())->method('endTracking')->with(self::equalTo($task));

    The next 26 lines appear both in tests/Worker/WorkerTest.php:372 and tests/Worker/WorkerTest.php:465.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. $transport = new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([
  7. new FirstInFirstOutPolicy(),
  8. ]));
  1. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  2. $tracker->expects(self::never())->method('startTracking')->with(self::equalTo($task));
  3. $tracker->expects(self::never())->method('endTracking')->with(self::equalTo($task));
  4. $transport = new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([

    The next 24 lines appear both in tests/Worker/WorkerTest.php:374 and tests/Worker/WorkerTest.php:560.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. new FirstInFirstOutPolicy(),
  6. ]));
  7. $scheduler = new Scheduler('UTC', $transport, new SchedulerMiddlewareStack(), new EventDispatcher());
  8. $scheduler->schedule($task);
  1. $scheduler->schedule($validTask);
  2. $eventDispatcher = new EventDispatcher();
  3. $eventDispatcher->addSubscriber(new StopWorkerOnTaskLimitSubscriber(2));
  4. $lockFactory = new LockFactory(new InMemoryStore());

    The next 23 lines appear both in tests/Worker/WorkerTest.php:432 and tests/Worker/WorkerTest.php:525.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  5. $worker = new Worker($scheduler, new RunnerRegistry([
  6. new NullTaskRunner(),
  7. ]), new ExecutionPolicyRegistry([
  8. new DefaultPolicy(),
  1. }
  2. /**
  3. * @throws Throwable {@see WorkerInterface::preempt()}
  4. */
  5. public function testWorkerCanPreempt(): void

    The next 28 lines appear both in tests/Worker/WorkerTest.php:1714 and tests/Worker/WorkerTest.php:1761.

    Time to fix: about 4 hours
    Read doc Open Issue Permalink
    Last edited by Guillaume Loulier
  6. {
  7. $logger = $this->createMock(LoggerInterface::class);
  8. $tracker = $this->createMock(TaskExecutionTrackerInterface::class);
  9. $transport = new InMemoryTransport(new InMemoryConfiguration(), new SchedulePolicyOrchestrator([