-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #134 Fix ThemeCollector Symfony 7 compatibility (alexander-schranz)
This PR was merged into the 2.4 branch. Discussion ---------- > PHP Fatal error: Type of Sylius\Bundle\ThemeBundle\Collector\ThemeCollector::$data must be Symfony\Component\VarDumper\Cloner\Data|array (as in class Symfony\Component\HttpKernel\DataCollector\DataCollector) in /home/runner/work/SyliusThemeBundle/SyliusThemeBundle/src/Collector/ThemeCollector.php on line 24 I added a very simple test case which just init the ThemeCollector to catch this. Commits ------- fc93513 Fix ThemeCollector Symfony 7 compatibility cbdfa38 Add test case with ThemeCollector bcf4eaf Fix PHPDoc for getUsedThemes 288b7bb Lint building of container f143501 Apply suggestions from code review
- Loading branch information
Showing
3 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Bundle\ThemeBundle\Tests\Collector; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Sylius\Bundle\ThemeBundle\Collector\ThemeCollector; | ||
use Sylius\Bundle\ThemeBundle\Context\EmptyThemeContext; | ||
use Sylius\Bundle\ThemeBundle\HierarchyProvider\NoopThemeHierarchyProvider; | ||
use Sylius\Bundle\ThemeBundle\Loader\ThemeLoaderInterface; | ||
use Sylius\Bundle\ThemeBundle\Repository\InMemoryThemeRepository; | ||
|
||
class ThemeCollectorTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_has_no_used_theme(): void | ||
{ | ||
$themeCollector = $this->createThemeCollector(); | ||
|
||
$this->assertNull($themeCollector->getUsedTheme()); | ||
} | ||
|
||
private function createThemeCollector(): ThemeCollector | ||
{ | ||
$themeLoader = new class () implements ThemeLoaderInterface { | ||
public function load(): array | ||
{ | ||
return []; | ||
} | ||
}; | ||
|
||
$themeRepository = new InMemoryThemeRepository($themeLoader); | ||
$themeContext = new EmptyThemeContext(); | ||
$themeHierarchyProvider = new NoopThemeHierarchyProvider(); | ||
|
||
return new ThemeCollector( | ||
$themeRepository, | ||
$themeContext, | ||
$themeHierarchyProvider, | ||
); | ||
} | ||
} |