36 $this->storeManager = $this->createMock(\
Magento\Store\Model\StoreManagerInterface::class);
37 $this->themeProvider = $this->createMock(\
Magento\Framework\View\
Design\
Theme\ThemeProviderInterface::class);
38 $this->configData = $this->createPartialMock(
40 [
'getCollection',
'addFieldToFilter']
42 $this->themeValidator = new \Magento\Theme\Model\ThemeValidator(
52 $theme->expects($this->once())->method(
'getId')->willReturn(6);
53 $defaultEntity = new \Magento\Framework\DataObject([
'value' => 6,
'scope' =>
'default',
'scope_id' => 8]);
54 $websitesEntity = new \Magento\Framework\DataObject([
'value' => 6,
'scope' =>
'websites',
'scope_id' => 8]);
55 $storesEntity = new \Magento\Framework\DataObject([
'value' => 6,
'scope' =>
'stores',
'scope_id' => 8]);
56 $this->themeProvider->expects($this->once())->method(
'getThemeByFullPath')->willReturn(
$theme);
57 $this->configData->expects($this->once())->method(
'getCollection')->willReturn($this->configData);
59 ->expects($this->at(1))
60 ->method(
'addFieldToFilter')
61 ->willReturn($this->configData);
63 ->expects($this->at(2))
64 ->method(
'addFieldToFilter')
65 ->willReturn([$defaultEntity, $websitesEntity, $storesEntity]);
66 $website = $this->createPartialMock(\
Magento\Store\Model\Website::class, [
'getName']);
67 $website->expects($this->once())->method(
'getName')->willReturn(
'websiteA');
68 $store = $this->createPartialMock(\
Magento\Store\Model\Store::class, [
'getName']);
69 $store->expects($this->once())->method(
'getName')->willReturn(
'storeA');
70 $this->storeManager->expects($this->once())->method(
'getWebsite')->willReturn(
$website);
71 $this->storeManager->expects($this->once())->method(
'getStore')->willReturn(
$store);
72 $result = $this->themeValidator->validateIsThemeInUse([
'frontend/Magento/a']);
75 '<error>frontend/Magento/a is in use in default config</error>',
76 '<error>frontend/Magento/a is in use in website websiteA</error>',
77 '<error>frontend/Magento/a is in use in store storeA</error>'
testValidateIsThemeInUse()