Skip to content

Commit df3201c

Browse files
author
Igor Melnikov
committed
MAGETWO-63450: Create integration tests for ThemeProvider
- refactoring
1 parent c29ac25 commit df3201c

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

dev/tests/integration/testsuite/Magento/Theme/Model/Theme/ThemeProviderTest.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class ThemeProviderTest extends \PHPUnit_Framework_TestCase
1515
/**
1616
* @var ThemeProvider
1717
*/
18-
private $themeProvider1;
18+
private $themeProviderOne;
1919

2020
/**
2121
* @var ThemeProvider
2222
*/
23-
private $themeProvider2;
23+
private $themeProviderTwo;
2424

2525
/**
2626
* @var ThemeCollection
@@ -30,8 +30,8 @@ class ThemeProviderTest extends \PHPUnit_Framework_TestCase
3030
protected function setUp()
3131
{
3232
$objectManager = Bootstrap::getObjectManager();
33-
$this->themeProvider1 = $objectManager->create(ThemeProvider::class);
34-
$this->themeProvider2 = clone $this->themeProvider1;
33+
$this->themeProviderOne = $objectManager->create(ThemeProvider::class);
34+
$this->themeProviderTwo = clone $this->themeProviderOne;
3535
$this->themeCollection = $objectManager->create(ThemeCollection::class);
3636
CacheCleaner::clean();
3737
}
@@ -40,9 +40,14 @@ public function testGetThemeById()
4040
{
4141
/** @var Theme $theme */
4242
foreach ($this->themeCollection as $theme) {
43+
$theme = $this->themeProviderOne->getThemeById($theme->getId());
4344
$this->assertSame(
44-
$this->themeProvider1->getThemeById($theme->getId())->getData(),
45-
$this->themeProvider2->getThemeById($theme->getId())->getData()
45+
$theme,
46+
$this->themeProviderOne->getThemeById($theme->getId())
47+
);
48+
$this->assertSame(
49+
$theme->getData(),
50+
$this->themeProviderTwo->getThemeById($theme->getId())->getData()
4651
);
4752
}
4853
}
@@ -51,9 +56,14 @@ public function testGetThemeByFullPath()
5156
{
5257
/** @var Theme $theme */
5358
foreach ($this->themeCollection as $theme) {
59+
$theme = $this->themeProviderOne->getThemeByFullPath($theme->getFullPath());
60+
$this->assertSame(
61+
$theme,
62+
$this->themeProviderOne->getThemeByFullPath($theme->getFullPath())
63+
);
5464
$this->assertSame(
55-
$this->themeProvider1->getThemeByFullPath($theme->getFullPath())->getData(),
56-
$this->themeProvider2->getThemeByFullPath($theme->getFullPath())->getData()
65+
$theme->getData(),
66+
$this->themeProviderTwo->getThemeByFullPath($theme->getFullPath())->getData()
5767
);
5868
}
5969
}

0 commit comments

Comments
 (0)