Skip to content

Commit 9f30359

Browse files
ACPT-1552 WIP
1 parent 0944abf commit 9f30359

File tree

3 files changed

+29
-13
lines changed

3 files changed

+29
-13
lines changed

app/code/Magento/Theme/Model/Theme/ThemeProvider.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
namespace Magento\Theme\Model\Theme;
77

88
use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
910
use Magento\Framework\Serialize\Serializer\Json;
1011
use Magento\Framework\View\Design\Theme\ListInterface;
1112
use Magento\Framework\App\DeploymentConfig;
13+
use Magento\Framework\View\Design\Theme\ThemeProviderInterface;
1214

1315
/**
1416
* Provide data for theme grid and for theme edit page
1517
*/
16-
class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProviderInterface
18+
class ThemeProvider implements ThemeProviderInterface, ResetAfterRequestInterface
1719
{
1820
/**
1921
* @var \Magento\Theme\Model\ResourceModel\Theme\CollectionFactory
@@ -31,24 +33,24 @@ class ThemeProvider implements \Magento\Framework\View\Design\Theme\ThemeProvide
3133
protected $cache;
3234

3335
/**
34-
* @var \Magento\Framework\View\Design\ThemeInterface[]
36+
* @var \Magento\Framework\View\Design\ThemeInterface[]|null
3537
*/
3638
private $themes;
3739

3840
/**
39-
* @var ListInterface
41+
* @var ListInterface|null
4042
*/
4143
private $themeList;
4244

4345
/**
4446
* @var DeploymentConfig
4547
*/
46-
private $deploymentConfig;
48+
private readonly DeploymentConfig $deploymentConfig;
4749

4850
/**
4951
* @var Json
5052
*/
51-
private $serializer;
53+
private readonly Json $serializer;
5254

5355
/**
5456
* ThemeProvider constructor.
@@ -183,4 +185,10 @@ private function getThemeList()
183185
}
184186
return $this->themeList;
185187
}
188+
189+
public function _resetState(): void
190+
{
191+
$this->themeList = null;
192+
$this->themes = null;
193+
}
186194
}

lib/internal/Magento/Framework/Css/PreProcessor/Instruction/MagentoImport.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Framework\App\ObjectManager;
99
use Magento\Framework\Css\PreProcessor\ErrorHandlerInterface;
10+
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1011
use Magento\Framework\View\Asset\File\FallbackContext;
1112
use Magento\Framework\View\Asset\LocalInterface;
1213
use Magento\Framework\View\Asset\PreProcessorInterface;
@@ -18,7 +19,7 @@
1819
* @magento_import instruction preprocessor
1920
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) Must be deleted after moving themeProvider to construct
2021
*/
21-
class MagentoImport implements PreProcessorInterface
22+
class MagentoImport implements PreProcessorInterface, ResetAfterRequestInterface
2223
{
2324
/**
2425
* PCRE pattern that matches @magento_import instruction
@@ -53,7 +54,7 @@ class MagentoImport implements PreProcessorInterface
5354
protected $themeList;
5455

5556
/**
56-
* @var ThemeProviderInterface
57+
* @var ThemeProviderInterface|null
5758
*/
5859
private $themeProvider;
5960

@@ -145,7 +146,14 @@ private function getThemeProvider()
145146
if (null === $this->themeProvider) {
146147
$this->themeProvider = ObjectManager::getInstance()->get(ThemeProviderInterface::class);
147148
}
148-
149149
return $this->themeProvider;
150150
}
151+
152+
/**
153+
* @inheritDoc
154+
*/
155+
public function _resetState(): void
156+
{
157+
$this->themeProvider = null;
158+
}
151159
}

lib/internal/Magento/Framework/TestFramework/ApplicationStateComparator/_files/state-skip-list.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@
371371
Magento\Customer\Model\Group\Interceptor::class => null,
372372
Magento\Store\Model\Group\Interceptor::class => null,
373373
Magento\Directory\Model\Currency\Interceptor::class => null,
374-
Magento\Theme\Model\Theme\ThemeProvider::class => null, // Needs _resetState for themes
374+
// Magento\Theme\Model\Theme\ThemeProvider::class => null, // Needs _resetState for themes
375375
Magento\Catalog\Model\Category\AttributeRepository::class => null, // Note: has reloadState
376376
// Magento\Framework\Search\Request\Cleaner::class => null, // FIXME: Needs resetState
377377
Magento\Catalog\Model\ResourceModel\Category\Interceptor::class => null,
@@ -423,10 +423,10 @@
423423
null, // Note: We may need to check to see if this needs to be reset when config changes
424424
Magento\ConfigurableProduct\Model\Product\Type\Configurable\Interceptor::class => null,
425425
Magento\Catalog\Model\Product\Type\Simple\Interceptor::class => null,
426-
Magento\Customer\Model\Session\Storage::class =>
427-
null, // FIXME: race condition with Magento\Customer\Model\Session::_resetState()
428-
Magento\Eav\Api\Data\AttributeExtension::class
429-
=> null, // FIXME: This needs to be fixed. is_pagebuilder_enabled 0 => null
426+
// Magento\Customer\Model\Session\Storage::class =>
427+
// null, // FIXME: race condition with Magento\Customer\Model\Session::_resetState()
428+
// Magento\Eav\Api\Data\AttributeExtension::class
429+
// => null, // FIXME: This needs to be fixed. is_pagebuilder_enabled 0 => null
430430
Magento\TestFramework\Event\Magento::class => null,
431431
Magento\Store\Model\Website\Interceptor::class => null, // reset by poison pill
432432
Magento\Eav\Model\Entity\Type::class => null, // attribute types should be destroyed by poison pill

0 commit comments

Comments
 (0)