Skip to content

Commit

Permalink
Merge 4.x into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Jun 5, 2023
2 parents 894d298 + 801aaa1 commit 853e165
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ jobs:
dependencies: highest
allowed-to-fail: false
variant: sonata-project/form-extensions:"2.0.0-alpha-1"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
variant: sonata-project/block-bundle:"5.0.0-alpha-1"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.10.0](https://github.com/sonata-project/SonataMediaBundle/compare/4.9.0...4.10.0) - 2023-06-04
### Added
- [[#2396](https://github.com/sonata-project/SonataMediaBundle/pull/2396)] Support for SonataBlockBundle 5.0 ([@jordisala1991](https://github.com/jordisala1991))

## [4.9.0](https://github.com/sonata-project/SonataMediaBundle/compare/4.8.1...4.9.0) - 2023-05-13
### Added
- [[#2393](https://github.com/sonata-project/SonataMediaBundle/pull/2393)] Support for `sonata-project/form-extensions` 2.0 ([@jordisala1991](https://github.com/jordisala1991))
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"psalm/plugin-symfony": "^5.0",
"rector/rector": "^0.16",
"sonata-project/admin-bundle": "^4.9",
"sonata-project/block-bundle": "^4.11",
"sonata-project/block-bundle": "^4.11 || ^5.0",
"sonata-project/classification-bundle": "^4.0",
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
"symfony/browser-kit": "^5.4 || ^6.2",
Expand Down
20 changes: 15 additions & 5 deletions tests/Block/FeatureMediaBlockServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use PHPUnit\Framework\MockObject\Stub;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\BlockBundle\Cache\HttpCacheHandler;
use Sonata\BlockBundle\Test\BlockServiceTestCase;
use Sonata\MediaBundle\Block\FeatureMediaBlockService;
use Sonata\MediaBundle\Model\MediaInterface;
Expand All @@ -40,15 +41,17 @@ protected function setUp(): void
);
}

/**
* @psalm-suppress DeprecatedClass
*/
public function testDefaultSettings(): void
{
$blockContext = $this->getBlockContext($this->blockService);

$this->assertSettings([
$settings = [
'attr' => [],
'content' => false,
'context' => false,
'extra_cache_keys' => [],
'format' => false,
'media' => false,
'mediaId' => null,
Expand All @@ -58,8 +61,15 @@ public function testDefaultSettings(): void
'translation_domain' => null,
'icon' => null,
'class' => null,
'ttl' => 0,
'use_cache' => true,
], $blockContext);
];

// TODO: Remove if when dropping support for sonata-project/block-bundle < 5.0
if (class_exists(HttpCacheHandler::class)) {
$settings['extra_cache_keys'] = [];
$settings['ttl'] = 0;
$settings['use_cache'] = true;
}

$this->assertSettings($settings, $blockContext);
}
}
20 changes: 15 additions & 5 deletions tests/Block/GalleryBlockServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPUnit\Framework\MockObject\Stub;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Sonata\BlockBundle\Cache\HttpCacheHandler;
use Sonata\BlockBundle\Model\Block;
use Sonata\BlockBundle\Test\BlockServiceTestCase;
use Sonata\MediaBundle\Block\GalleryBlockService;
Expand Down Expand Up @@ -69,14 +70,16 @@ public function testExecute(): void
$this->blockService->execute($blockContext);
}

/**
* @psalm-suppress DeprecatedClass
*/
public function testDefaultSettings(): void
{
$blockContext = $this->getBlockContext($this->blockService);

$this->assertSettings([
$settings = [
'attr' => [],
'context' => false,
'extra_cache_keys' => [],
'format' => false,
'gallery' => false,
'galleryId' => null,
Expand All @@ -87,8 +90,15 @@ public function testDefaultSettings(): void
'translation_domain' => null,
'icon' => null,
'class' => null,
'ttl' => 0,
'use_cache' => true,
], $blockContext);
];

// TODO: Remove if when dropping support for sonata-project/block-bundle < 5.0
if (class_exists(HttpCacheHandler::class)) {
$settings['extra_cache_keys'] = [];
$settings['ttl'] = 0;
$settings['use_cache'] = true;
}

$this->assertSettings($settings, $blockContext);
}
}
20 changes: 15 additions & 5 deletions tests/Block/MediaBlockServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPUnit\Framework\MockObject\Stub;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Sonata\BlockBundle\Cache\HttpCacheHandler;
use Sonata\BlockBundle\Model\Block;
use Sonata\BlockBundle\Test\BlockServiceTestCase;
use Sonata\MediaBundle\Block\MediaBlockService;
Expand Down Expand Up @@ -76,14 +77,16 @@ public function testExecute(): void
$this->blockService->execute($blockContext);
}

/**
* @psalm-suppress DeprecatedClass
*/
public function testDefaultSettings(): void
{
$blockContext = $this->getBlockContext($this->blockService);

$this->assertSettings([
$settings = [
'attr' => [],
'context' => false,
'extra_cache_keys' => [],
'format' => false,
'media' => false,
'mediaId' => null,
Expand All @@ -92,9 +95,16 @@ public function testDefaultSettings(): void
'translation_domain' => null,
'icon' => null,
'class' => null,
'ttl' => 0,
'use_cache' => true,
], $blockContext);
];

// TODO: Remove if when dropping support for sonata-project/block-bundle < 5.0
if (class_exists(HttpCacheHandler::class)) {
$settings['extra_cache_keys'] = [];
$settings['ttl'] = 0;
$settings['use_cache'] = true;
}

$this->assertSettings($settings, $blockContext);
}

private function configureFormat(MockObject $media, string $format): void
Expand Down

0 comments on commit 853e165

Please sign in to comment.