TYPO3 CMS  TYPO3_6-2
PhpFrontendTest.php
Go to the documentation of this file.
1 <?php
3 
25 
30  public function setChecksIfTheIdentifierIsValid() {
31  $cache = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\StringFrontend', array('isValidEntryIdentifier'), array(), '', FALSE);
32  $cache->expects($this->once())->method('isValidEntryIdentifier')->with('foo')->will($this->returnValue(FALSE));
33  $cache->set('foo', 'bar');
34  }
35 
40  $originalSourceCode = 'return "hello world!";';
41  $modifiedSourceCode = '<?php' . chr(10) . $originalSourceCode . chr(10) . '#';
42  $mockBackend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Backend\\PhpCapableBackendInterface', array(), array(), '', FALSE);
43  $mockBackend->expects($this->once())->method('set')->with('Foo-Bar', $modifiedSourceCode, array('tags'), 1234);
44  $cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend', 'PhpFrontend', $mockBackend);
45  $cache->set('Foo-Bar', $originalSourceCode, array('tags'), 1234);
46  }
47 
53  $cache = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend', array('dummy'), array(), '', FALSE);
54  $cache->set('Foo-Bar', array());
55  }
56 
61  $mockBackend = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Backend\\PhpCapableBackendInterface', array(), array(), '', FALSE);
62  $mockBackend->expects($this->once())->method('requireOnce')->with('Foo-Bar')->will($this->returnValue('hello world!'));
63  $cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend', 'PhpFrontend', $mockBackend);
64  $result = $cache->requireOnce('Foo-Bar');
65  $this->assertSame('hello world!', $result);
66  }
67 
68 }
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren&#39;t numeric.