-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #520 from magento-ogre/PR_Branch
[Ogres] Bug Fixes
- Loading branch information
Showing
257 changed files
with
949 additions
and
3,277 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
35 changes: 35 additions & 0 deletions
35
app/code/Magento/Backend/Test/Unit/Console/Command/AbstractCacheCommandTest.php
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,35 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Backend\Test\Unit\Console\Command; | ||
|
||
use Magento\Backend\Console\Command\AbstractCacheManageCommand; | ||
|
||
abstract class AbstractCacheCommandTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var \Magento\Framework\App\Cache\Manager|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected $cacheManager; | ||
|
||
/** | ||
* @var AbstractCacheManageCommand | ||
*/ | ||
protected $command; | ||
|
||
public function setUp() | ||
{ | ||
$this->cacheManager = $this->getMock('Magento\Framework\App\Cache\Manager', [], [], '', false); | ||
} | ||
|
||
/** | ||
* Formats expected output for testExecute data providers | ||
* | ||
* @param array $types | ||
* @return string | ||
*/ | ||
abstract public function getExpectedExecutionOutput(array $types); | ||
} |
43 changes: 43 additions & 0 deletions
43
app/code/Magento/Backend/Test/Unit/Console/Command/AbstractCacheManageCommandTest.php
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,43 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Backend\Test\Unit\Console\Command; | ||
|
||
use Symfony\Component\Console\Tester\CommandTester; | ||
|
||
abstract class AbstractCacheManageCommandTest extends AbstractCacheCommandTest | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function testExecuteDataProvider() | ||
{ | ||
return [ | ||
'implicit all' => [ | ||
[], | ||
['A', 'B', 'C'], | ||
$this->getExpectedExecutionOutput(['A', 'B', 'C']), | ||
], | ||
'specified types' => [ | ||
['types' => ['A', 'B']], | ||
['A', 'B'], | ||
$this->getExpectedExecutionOutput(['A', 'B']), | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @expectedException \InvalidArgumentException | ||
* @expectedExceptionMessage The following requested cache types are not supported: | ||
*/ | ||
public function testExecuteInvalidCacheType() | ||
{ | ||
$this->cacheManager->expects($this->once())->method('getAvailableTypes')->willReturn(['A', 'B', 'C']); | ||
$param = ['types' => ['A', 'D']]; | ||
$commandTester = new CommandTester($this->command); | ||
$commandTester->execute($param); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
app/code/Magento/Backend/Test/Unit/Console/Command/AbstractCacheSetCommandTest.php
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,57 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Backend\Test\Unit\Console\Command; | ||
|
||
abstract class AbstractCacheSetCommandTest extends AbstractCacheManageCommandTest | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function testExecuteDataProvider() | ||
{ | ||
return [ | ||
'implicit all' => [ | ||
[], | ||
['A', 'B', 'C'], | ||
['A', 'B', 'C'], | ||
$this->getExpectedExecutionOutput(['A', 'B', 'C']), | ||
], | ||
'specified types' => [ | ||
['types' => ['A', 'B']], | ||
['A', 'B'], | ||
['A', 'B'], | ||
$this->getExpectedExecutionOutput(['A', 'B']), | ||
], | ||
'no changes' => [ | ||
['types' => ['A', 'B']], | ||
['A', 'B'], | ||
[], | ||
$this->getExpectedExecutionOutput([]), | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Formats expected output of cache status change | ||
* | ||
* @param array $changes | ||
* @param bool $enabled | ||
* @return string | ||
*/ | ||
public function getExpectedChangeOutput(array $changes, $enabled) | ||
{ | ||
if ($changes) { | ||
$output = 'Changed cache status:' . PHP_EOL; | ||
foreach ($changes as $type) { | ||
$output .= sprintf('%30s: %d -> %d', $type, $enabled === false, $enabled === true) . PHP_EOL; | ||
} | ||
} else { | ||
$output = 'There is nothing to change in cache status' . PHP_EOL; | ||
} | ||
return $output; | ||
} | ||
} |
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
Oops, something went wrong.