TYPO3 CMS  TYPO3_7-6
IndexerTest.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  */
16 
21 
26 {
31  {
32  $mockStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, [], [], '', false);
33  $mockFile = $this->getMock(File::class, [], [], '', false);
34  $mockFile->expects($this->any())->method('getType')->will($this->returnValue(
36  ));
37 
38  $mockExtractor = $this->getMock(ExtractorInterface::class, [], [], '', false);
39  $mockExtractor->expects($this->any())->method('getFileTypeRestrictions')->will($this->returnValue(
41  ));
42 
43  $method = new \ReflectionMethod(Indexer::class, 'isFileTypeSupportedByExtractor');
44  $method->setAccessible(true);
45  $arguments = [
46  $mockFile,
47  $mockExtractor
48  ];
49 
50  $result = $method->invokeArgs(new Indexer($mockStorage), $arguments);
51  $this->assertFalse($result);
52  }
53 
58  {
59  $mockStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, [], [], '', false);
60  $mockFile = $this->getMock(File::class, [], [], '', false);
61  $mockFile->expects($this->any())->method('getType')->will($this->returnValue(
63  ));
64 
65  $mockExtractor = $this->getMock(ExtractorInterface::class, [], [], '', false);
66  $mockExtractor->expects($this->any())->method('getFileTypeRestrictions')->will($this->returnValue(
68  ));
69 
70  $method = new \ReflectionMethod(Indexer::class, 'isFileTypeSupportedByExtractor');
71  $method->setAccessible(true);
72  $arguments = [
73  $mockFile,
74  $mockExtractor
75  ];
76 
77  $result = $method->invokeArgs(new Indexer($mockStorage), $arguments);
78  $this->assertTrue($result);
79  }
80 
85  {
86  $mockStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, [], [], '', false);
87  $mockFile = $this->getMock(File::class, [], [], '', false);
88  $mockFile->expects($this->any())->method('getType')->will($this->returnValue(
90  ));
91 
92  $mockExtractor = $this->getMock(ExtractorInterface::class, [], [], '', false);
93  $mockExtractor->expects($this->any())->method('getFileTypeRestrictions')->will($this->returnValue(
94  []
95  ));
96 
97  $method = new \ReflectionMethod(Indexer::class, 'isFileTypeSupportedByExtractor');
98  $method->setAccessible(true);
99  $arguments = [
100  $mockFile,
101  $mockExtractor
102  ];
103 
104  $result = $method->invokeArgs(new Indexer($mockStorage), $arguments);
105  $this->assertTrue($result);
106  }
107 }