Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BareTest.php
Go to the documentation of this file.
1 <?php
7 
8 class BareTest extends \PHPUnit\Framework\TestCase
9 {
16  public function testProxyMethod($method, $params, $expectedResult)
17  {
18  $frontendMock = $this->createMock(\Magento\Framework\Cache\FrontendInterface::class);
19 
20  $object = new \Magento\Framework\Cache\Frontend\Decorator\Bare($frontendMock);
21  $helper = new \Magento\Framework\TestFramework\Unit\Helper\ProxyTesting();
22  $result = $helper->invokeWithExpectations($object, $frontendMock, $method, $params, $expectedResult);
23  $this->assertSame($expectedResult, $result);
24  }
25 
29  public function proxyMethodDataProvider()
30  {
31  return [
32  ['test', ['record_id'], 111],
33  ['load', ['record_id'], '111'],
34  ['save', ['record_value', 'record_id', ['tag'], 555], true],
35  ['remove', ['record_id'], true],
36  ['clean', [\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, ['tag']], true],
37  ['getBackend', [], $this->createMock(\Zend_Cache_Backend::class)],
38  ['getLowLevelFrontend', [], $this->createMock(\Zend_Cache_Core::class)],
39  ];
40  }
41 }
$helper
Definition: iframe.phtml:13
$method
Definition: info.phtml:13
const CLEANING_MODE_MATCHING_ANY_TAG
Definition: Cache.php:76
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18
testProxyMethod($method, $params, $expectedResult)
Definition: BareTest.php:16