Merge branch '8.0' into 8.1

* 8.0: (27 commits)
  [JsonStreamer] Fix exponential resource class memory growth
  [Cache] Fix DSN auth not passed to clusters in RedisTrait
  do not parse "scalar" as an object
  [Form] Fix OrderedHashMap auto-increment logic with mixed keys
  [HttpClient] Skip HTTP/3 when using a proxy
  don't skip custom view transformers while normalizing submitted newlines
  [Serializer] Fix is/has/can accessor naming regression while preserving collision detection
  fix exception "Symfony\Component\TypeInfo\Exception\InvalidArgumentException: "Symfony\Component\TypeInfo\Type\UnionType" expects at least 2 types." when property phpdoc is "value-of<Enum>|null"
  [DoctrineBridge] Fix custom type based on Uid on entity loader
  let tests fail on PHPUnit notices
  [PropertyInfo] Throw when phpdocumentor/reflection-docblock v6 is in use (branch 6.4 only)
  do not use PHPUnit mock objects without configured expectations
  [Form] Fix ICU 72+ whitespace handling in `DateTimeToLocalizedStringTransformer`
  [ErrorHandler] fix parsing of complexe type
  do not use PHPUnit mock objects without configured expectations
  [Process] Adjust Process mustRun method phpdoc
  do not use PHPUnit mock objects without configured expectations
  do not use PHPUnit mock objects without configured expectations
  do not use PHPUnit mock objects without configured expectations
  do not use PHPUnit mock objects without configured expectations
  ...
This commit is contained in:
Nicolas Grekas
2026-01-23 12:09:22 +01:00
8 changed files with 24 additions and 24 deletions

View File

@@ -33,14 +33,14 @@ class DispatchSchedulerEventListenerTest extends TestCase
{
public function testDispatchSchedulerEvents()
{
$trigger = $this->createMock(TriggerInterface::class);
$trigger = $this->createStub(TriggerInterface::class);
$defaultRecurringMessage = RecurringMessage::trigger($trigger, (object) ['id' => 'default']);
$schedulerProvider = new SomeScheduleProvider([$defaultRecurringMessage]);
$scheduleProviderLocator = new Container();
$scheduleProviderLocator->set('default', $schedulerProvider);
$context = new MessageContext('default', 'default', $trigger, $this->createMock(\DateTimeImmutable::class));
$context = new MessageContext('default', 'default', $trigger, new \DateTimeImmutable());
$envelope = (new Envelope(new \stdClass()))->with(new ScheduledStamp($context));
$listener = new DispatchSchedulerEventListener($scheduleProviderLocator, $eventDispatcher = new EventDispatcher());

View File

@@ -366,7 +366,7 @@ class MessageGeneratorTest extends TestCase
sort($runs);
$ticks = [self::makeDateTime(''), 0];
$trigger = $this->createMock(TriggerInterface::class);
$trigger = $this->createStub(TriggerInterface::class);
$trigger
->method('getNextRunDate')
->willReturnCallback(function (\DateTimeImmutable $lastTick) use ($runs, &$ticks): \DateTimeImmutable {

View File

@@ -12,8 +12,8 @@
namespace Symfony\Component\Scheduler\Tests\Messenger;
use PHPUnit\Framework\TestCase;
use Psr\Clock\ClockInterface;
use Psr\Container\ContainerInterface;
use Symfony\Component\Clock\MockClock;
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
use Symfony\Component\Scheduler\Exception\InvalidArgumentException;
use Symfony\Component\Scheduler\Generator\MessageGenerator;
@@ -29,9 +29,9 @@ class SchedulerTransportFactoryTest extends TestCase
{
public function testCreateTransport()
{
$trigger = $this->createMock(TriggerInterface::class);
$serializer = $this->createMock(SerializerInterface::class);
$clock = $this->createMock(ClockInterface::class);
$trigger = $this->createStub(TriggerInterface::class);
$serializer = $this->createStub(SerializerInterface::class);
$clock = new MockClock();
$defaultRecurringMessage = RecurringMessage::trigger($trigger, (object) ['id' => 'default']);
$customRecurringMessage = RecurringMessage::trigger($trigger, (object) ['id' => 'custom']);
@@ -58,7 +58,7 @@ class SchedulerTransportFactoryTest extends TestCase
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The given Schedule DSN "schedule://#wrong" is invalid.');
$factory->createTransport('schedule://#wrong', [], $this->createMock(SerializerInterface::class));
$factory->createTransport('schedule://#wrong', [], $this->createStub(SerializerInterface::class));
}
public function testNoName()
@@ -68,7 +68,7 @@ class SchedulerTransportFactoryTest extends TestCase
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The Schedule DSN must contains a name, e.g. "schedule://default".');
$factory->createTransport('schedule://', [], $this->createMock(SerializerInterface::class));
$factory->createTransport('schedule://', [], $this->createStub(SerializerInterface::class));
}
public function testNotFound()
@@ -78,7 +78,7 @@ class SchedulerTransportFactoryTest extends TestCase
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The schedule "not-exists" is not found.');
$factory->createTransport('schedule://not-exists', [], $this->createMock(SerializerInterface::class));
$factory->createTransport('schedule://not-exists', [], $this->createStub(SerializerInterface::class));
}
public function testSupports()
@@ -95,9 +95,9 @@ class SchedulerTransportFactoryTest extends TestCase
{
return new SchedulerTransportFactory(
new Container([
'default' => fn () => $this->createMock(ScheduleProviderInterface::class),
'default' => fn () => $this->createStub(ScheduleProviderInterface::class),
]),
$this->createMock(ClockInterface::class),
new MockClock(),
);
}
}

View File

@@ -29,9 +29,9 @@ class SchedulerTransportTest extends TestCase
(object) ['id' => 'first'],
(object) ['id' => 'second'],
];
$generator = $this->createMock(MessageGeneratorInterface::class);
$generator = $this->createStub(MessageGeneratorInterface::class);
$generator->method('getMessages')->willReturnCallback(function () use ($messages): \Generator {
$trigger = $this->createMock(TriggerInterface::class);
$trigger = $this->createStub(TriggerInterface::class);
$triggerAt = new \DateTimeImmutable('2020-02-20T02:00:00', new \DateTimeZone('UTC'));
yield (new MessageContext('default', 'id1', $trigger, $triggerAt)) => $messages[0];
yield (new MessageContext('default', 'id2', $trigger, $triggerAt)) => $messages[1];
@@ -51,9 +51,9 @@ class SchedulerTransportTest extends TestCase
public function testAddsStampToInnerRedispatchMessageEnvelope()
{
$generator = $this->createMock(MessageGeneratorInterface::class);
$generator = $this->createStub(MessageGeneratorInterface::class);
$generator->method('getMessages')->willReturnCallback(function (): \Generator {
yield new MessageContext('default', 'id', $this->createMock(TriggerInterface::class), new \DateTimeImmutable()) => new RedispatchMessage(new \stdClass(), ['transport']);
yield new MessageContext('default', 'id', $this->createStub(TriggerInterface::class), new \DateTimeImmutable()) => new RedispatchMessage(new \stdClass(), ['transport']);
});
$envelopes = iterator_to_array((new SchedulerTransport($generator))->get());
@@ -66,7 +66,7 @@ class SchedulerTransportTest extends TestCase
public function testAckIgnored()
{
$transport = new SchedulerTransport($this->createMock(MessageGeneratorInterface::class));
$transport = new SchedulerTransport($this->createStub(MessageGeneratorInterface::class));
$this->expectNotToPerformAssertions();
$transport->ack(new Envelope(new \stdClass()));
@@ -74,7 +74,7 @@ class SchedulerTransportTest extends TestCase
public function testRejectException()
{
$transport = new SchedulerTransport($this->createMock(MessageGeneratorInterface::class));
$transport = new SchedulerTransport($this->createStub(MessageGeneratorInterface::class));
$this->expectNotToPerformAssertions();
$transport->reject(new Envelope(new \stdClass()));
@@ -82,7 +82,7 @@ class SchedulerTransportTest extends TestCase
public function testSendException()
{
$transport = new SchedulerTransport($this->createMock(MessageGeneratorInterface::class));
$transport = new SchedulerTransport($this->createStub(MessageGeneratorInterface::class));
$this->expectException(LogicException::class);
$transport->send(new Envelope(new \stdClass()));

View File

@@ -20,7 +20,7 @@ class AbstractDecoratedTriggerTest extends TestCase
{
public function testCanGetInnerTrigger()
{
$trigger = new JitterTrigger($inner = $this->createMock(TriggerInterface::class));
$trigger = new JitterTrigger($inner = $this->createStub(TriggerInterface::class));
$this->assertSame($inner, $trigger->inner());
$this->assertSame([$trigger], iterator_to_array($trigger->decorators()));
@@ -29,7 +29,7 @@ class AbstractDecoratedTriggerTest extends TestCase
public function testCanGetNestedInnerTrigger()
{
$trigger = new ExcludeTimeTrigger(
$jitter = new JitterTrigger($inner = $this->createMock(TriggerInterface::class)),
$jitter = new JitterTrigger($inner = $this->createStub(TriggerInterface::class)),
new \DateTimeImmutable(),
new \DateTimeImmutable(),
);

View File

@@ -20,7 +20,7 @@ class CallbackMessageProviderTest extends TestCase
{
public function testToString()
{
$context = new MessageContext('test', 'test', $this->createMock(TriggerInterface::class), $this->createMock(\DateTimeImmutable::class));
$context = new MessageContext('test', 'test', $this->createStub(TriggerInterface::class), new \DateTimeImmutable());
$messageProvider = new CallbackMessageProvider(static fn () => []);
$this->assertEquals([], $messageProvider->getMessages($context));
$this->assertEquals('', $messageProvider->getId());

View File

@@ -19,7 +19,7 @@ class ExcludeTimeTriggerTest extends TestCase
{
public function testGetNextRun()
{
$inner = $this->createMock(TriggerInterface::class);
$inner = $this->createStub(TriggerInterface::class);
$inner
->method('getNextRunDate')
->willReturnCallback(static fn (\DateTimeImmutable $d) => $d->modify('+1 sec'));

View File

@@ -20,7 +20,7 @@ class JitterTriggerTest extends TestCase
public function testCanAddJitter()
{
$time = new \DateTimeImmutable();
$inner = $this->createMock(TriggerInterface::class);
$inner = $this->createStub(TriggerInterface::class);
$inner->method('getNextRunDate')->willReturn($time);
$trigger = new JitterTrigger($inner);