TYPO3 CMS  TYPO3_8-7
FluidTemplateCacheTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
18 
22 class FluidTemplateCacheTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
23 {
27  public function flushCallsFlushOnBackend()
28  {
29  $backend = $this->createMock(PhpCapableBackendInterface::class);
30  $backend->expects($this->once())->method('flush');
31  $instance = new FluidTemplateCache('dummy', $backend);
32  $instance->flush();
33  }
34 
38  public function getDelegatesToRequireOnce()
39  {
40  $instance = $this->getMockBuilder(FluidTemplateCache::class)
41  ->setMethods(['requireOnce'])
42  ->disableOriginalConstructor()
43  ->getMock();
44  $instance->expects($this->once())->method('requireOnce')->with('foobar');
45  $instance->get('foobar');
46  }
47 
51  public function setCallsSetOnBackend()
52  {
53  $backend = $this->createMock(PhpCapableBackendInterface::class);
54  $backend->expects($this->once())->method('set')->with(
55  'test',
56  '<?php' . LF . 'test' . LF . '#',
57  ['foobar'],
58  $this->anything()
59  );
60  $instance = new FluidTemplateCache('dummy', $backend);
61  $instance->set('test', 'test', ['foobar']);
62  }
63 
68  {
69  $backend = $this->createMock(PhpCapableBackendInterface::class);
70  $backend->expects($this->once())->method('set')->with(
71  'test',
72  '<?php' . LF . 'test' . LF . '#',
73  ['foobar'],
74  $this->anything()
75  );
76  $instance = new FluidTemplateCache('dummy', $backend);
77  $instance->set('test', '<?php' . LF . 'test', ['foobar']);
78  }
79 }