Bolt\Tests\BoltUnitTest::getMockCache PHP Метод

getMockCache() защищенный Метод

protected getMockCache ( null $path = null ) : Cache | PHPUnit_Framework_MockObject_MockObjec\PHPUnit_Framework_MockObject_MockObject
$path null
Результат Bolt\Cache | PHPUnit_Framework_MockObject_MockObjec\PHPUnit_Framework_MockObject_MockObject
    protected function getMockCache($path = null)
    {
        $app = $this->getApp();
        if ($path === null) {
            $path = $app['resources']->getPath('cache');
        }
        $params = [$path, Cache::EXTENSION, 02, $app['filesystem']];
        return $this->getMockBuilder(Cache::class)->setMethods(['flushAll'])->setConstructorArgs($params)->getMock();
    }

Usage Example

Пример #1
0
 protected function getMockCache($path = null, $flushResult = true)
 {
     $cache = parent::getMockCache($path);
     $cache->expects($this->once())->method('flushAll')->will($this->returnValue($flushResult));
     return $cache;
 }