Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
@@ -11,91 +13,20 @@
namespace Sonata\BlockBundle\Test;
use PHPUnit\Framework\TestCase;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Sonata\BlockBundle\Block\BlockContextManager;
use Sonata\BlockBundle\Block\BlockContextManagerInterface;
use Sonata\BlockBundle\Block\BlockServiceInterface;
use Sonata\BlockBundle\Block\BlockServiceManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@trigger_error(
'The '.__NAMESPACE__.'\AbstractBlockServiceTestCase class is deprecated since sonata-project/block-bundle 3.16 '.
'and will be removed with the 4.0 release. '.
'Use '.__NAMESPACE__.'\BlockServiceTestCase instead.',
E_USER_DEPRECATED
);
/**
* Abstract test class for block service tests.
*
* @author Sullivan Senechal <soullivaneuh@gmail.com>
*
* @deprecated since sonata-project/block-bundle 3.16, to be removed in 4.0. Use Sonata\BlockBundle\Test\BlockServiceTestCase instead.
*/
abstract class AbstractBlockServiceTestCase extends TestCase
abstract class AbstractBlockServiceTestCase extends BlockServiceTestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|ContainerInterface
*/
protected $container;
/**
* @var \PHPUnit_Framework_MockObject_MockObject|BlockServiceManagerInterface
*/
protected $blockServiceManager;
/**
* @var BlockContextManagerInterface
*/
protected $blockContextManager;
/**
* @var FakeTemplating
*/
protected $templating;
protected function setUp()
{
$this->container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface');
$this->templating = new FakeTemplating();
$blockLoader = $this->createMock('Sonata\BlockBundle\Block\BlockLoaderInterface');
$this->blockServiceManager = $this->createMock('Sonata\BlockBundle\Block\BlockServiceManagerInterface');
$this->blockContextManager = new BlockContextManager($blockLoader, $this->blockServiceManager);
}
/**
* Create a mocked block service.
*
* @param BlockServiceInterface $blockService A block service
*
* @return BlockContextInterface
*/
protected function getBlockContext(BlockServiceInterface $blockService)
{
$this->blockServiceManager->expects($this->once())->method('get')->will($this->returnValue($blockService));
$block = $this->createMock('Sonata\BlockBundle\Model\BlockInterface');
$block->expects($this->once())->method('getSettings')->will($this->returnValue([]));
$blockContext = $this->blockContextManager->get($block);
$this->assertInstanceOf('Sonata\BlockBundle\Block\BlockContextInterface', $blockContext);
return $blockContext;
}
/**
* Asserts that the block settings have the expected values.
*
* @param array $expected Expected settings
* @param BlockContextInterface $blockContext BlockContext object
*/
protected function assertSettings(array $expected, BlockContextInterface $blockContext)
{
$completeExpectedOptions = array_merge([
'use_cache' => true,
'extra_cache_keys' => [],
'attr' => [],
'template' => false,
'ttl' => 0,
], $expected);
ksort($completeExpectedOptions);
$blockSettings = $blockContext->getSettings();
ksort($blockSettings);
$this->assertSame($completeExpectedOptions, $blockSettings);
}
}